Posted by
Luigi Ballabio on
URL: http://quantlib.414.s1.nabble.com/how-to-compile-a-program-that-uses-quantlib-tp12154p12156.html
On Sat, 2008-07-12 at 20:41 -0700, mariav wrote:
> I wrote an extremely simple c++ program, but I cannot compile it.
>
> if I compile using
> g++ filename.cpp -o filename
>
> I get the error messages:
> error: ql/quantlib.hpp: No such file or directory
> 'Quantlib' is not a namespace-name
> expected namespace-name before ';' token
> My installation of Quantlib was done in the following way: I created a
> subdirectory called Quantlib in my
> home directory and extracted the files QuantLib-0.9.0 to there. I went to
> the QuantLib-0.9.0 directory (home/maria/Quantlib/QuantLib-0.9.0/ ) and
> typed
>
> ./configure --with-boost-include=/home/maria/Boost/boost_1_35_0
> --with-boost-lib=/home/maria/Boost/boost_1_35_0/libs
>
> make
Hi Maria,
as for most Linux programs, you also have to run 'make install' after
'make'. If you have administrator privileges on your computer, you can
run 'make install' with your current configuration (or 'sudo make
install' if you need to get the required privileges.) After that,
g++ filename.cpp -o filename -lQuantLib
should work. Otherwise, you can install in your user space: run first
./configure --with-boost-include=/home/maria/Boost/boost_1_35_0
--prefix=/home/maria/
(on one line, of course) and then 'make install'. The installation will
create a few directories (include, lib, bin...) in your home directory;
if you want them somewhere else, just provide a different prefix to
configure. After this, you can use
g++ filename.cpp -o filename -l/home/maria/include -L/home/maria/lib
-lQuantLib
(of course, replace /home/maria with the correct prefix if you chose a
different one.)
Luigi
--
Any software problem can be solved by adding another layer of
indirection.
-- Steven M. Bellovin
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev