Compile a quantlib C++ program

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Compile a quantlib C++ program

Nasky
Hi all,

 I'm a new user. I don't know how to compile a C++ program using QuantLib on Linux.

My code is heavily simple.

#include <ql/quantlib.hpp>

int main() {
   QuantLib::Real stuff ;
   return 0;
}


And I compile with : g++ -o stuff stuff.cpp
And I got lots of errors stating XXX cannot be found, not referenced, etc.

What should I add to my compilation line ? Something like "-lql" doesn't work.

Thanks
Reply | Threaded
Open this post in threaded view
|

Re: Compile a quantlib C++ program

Yang Ye
it shall also include the paths for include files and library files.

g++ -o stuff stuff.cpp -I/path/to/includefiles -L/path/to/libfiles -lql

Regards,
Yang Ye

Nasky wrote:

> Hi all,
>
>  I'm a new user. I don't know how to compile a C++ program using QuantLib on
> Linux.
>
> My code is heavily simple.
>
> #include <ql/quantlib.hpp>
>
> int main() {
>    QuantLib::Real stuff ;
>    return 0;
> }
>
>
> And I compile with : g++ -o stuff stuff.cpp
> And I got lots of errors stating XXX cannot be found, not referenced, etc.
>
> What should I add to my compilation line ? Something like "-lql" doesn't
> work.
>
> Thanks
>  


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev
Reply | Threaded
Open this post in threaded view
|

Re: Compile a quantlib C++ program

Luigi Ballabio
In reply to this post by Nasky

On Dec 22, 2007, at 2:17 PM, Nasky wrote:
>  I'm a new user. I don't know how to compile a C++ program using
> QuantLib on
> Linux.
>
> And I compile with : g++ -o stuff stuff.cpp
>
> What should I add to my compilation line ? Something like "-lql"
> doesn't
> work.

g++ -o stuff stuff.cpp -lQuantLib

assuming you have installed QuantLib in the default location (i.e., if
you didn't change it by explicitly adding a --prefix option to
configure)

Luigi


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev