Linker Error using Dev-C++ when including quantlib.hpp for test reasons

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

Linker Error using Dev-C++ when including quantlib.hpp for test reasons

thomas ehlenz
Hi,
 
I am using Dev-C++ and got boost 1.47.0, built it, got QuantLib 1.0.1, built it using the Dev-C++ project file "QuantLib.dev" --> library "libQuantLib-mgw.a" was created.
 
To test QuantLib I just included quantlib.hpp (#include <ql/quantlib.hpp>) in a standard 6 line code template and got tons of linker Errors (... undefined reference to 'Quantlib::...). Without the #include <ql/quantlib.hpp>, there's no problem.
 
I set up all include and library paths for boost as well as for quantlib in Dev-C++ (as you can see in the compiler log further down), so that should be fine.
 
What's the problem, why can't the linker find all the Quantlib methods, attributes and so on?
 
Greetings,
Thomas
 
The first lines of the compiler log reads:
 
Compiler: Default compiler
Building Makefile: "H:\Program_Files\QuantLib\QuantLibC++\QuantLib-1.0.1\Testing_QuantLib\Makefile.win"
Führt  make... aus
make.exe -f "H:\Program_Files\QuantLib\QuantLibC++\QuantLib-1.0.1\Testing_QuantLib\Makefile.win" all
g++.exe -c Testing_QuantLib_main.cpp -o Testing_QuantLib_main.o -I"lib/gcc/mingw32/3.4.2/include"  -I"include/c++/3.4.2/backward"  -I"include/c++/3.4.2/mingw32"  -I"include/c++/3.4.2"  -I"include"  -I"H:/Program_Files/QuantLib/boost/boost_1_47_0"  -I"H:/Program_Files/QuantLib/QuantLibC++/QuantLib-1.0.1"  
g++.exe Testing_QuantLib_main.o  -o "Testing_QuantLib.exe" -L"lib" -L"H:/Program_Files/QuantLib/boost/boost_1_47_0/stage/lib" -L"H:/Program_Files/QuantLib/QuantLibC++/QuantLib-1.0.1/lib" 
Testing_QuantLib_main.o(.rdata$_ZTCN8QuantLib25ZeroSpreadedTermStructureE0_NS_18ZeroYieldStructureE[construction vtable for QuantLib::ZeroYieldStructure-in-QuantLib::ZeroSpreadedTermStructure]+0x24):Testing_QuantLib_main.cpp: undefined reference to `QuantLib::TermStructure::referenceDate() const'
 
 

------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: Linker Error using Dev-C++ when including quantlib.hpp for test reasons

Luigi Ballabio
Hello Thomas,
    you're adding the library path, but not the library itself. You
have to tell Dev-C++ to add libQuantLib-mgw.a to your project.

Luigi


On Thu, Feb 16, 2012 at 5:35 PM, thomas ehlenz <[hidden email]> wrote:

> Hi,
>
> I am using Dev-C++ and got boost 1.47.0, built it, got QuantLib 1.0.1, built
> it using the Dev-C++ project file "QuantLib.dev" --> library
> "libQuantLib-mgw.a" was created.
>
> To test QuantLib I just included quantlib.hpp (#include <ql/quantlib.hpp>)
> in a standard 6 line code template and got tons of linker Errors (...
> undefined reference to 'Quantlib::...). Without the #include
> <ql/quantlib.hpp>, there's no problem.
>
> I set up all include and library paths for boost as well as for quantlib in
> Dev-C++ (as you can see in the compiler log further down), so that should be
> fine.
>
> What's the problem, why can't the linker find all the Quantlib methods,
> attributes and so on?
>
> Greetings,
> Thomas
>
> The first lines of the compiler log reads:
>
> Compiler: Default compiler
> Building Makefile:
> "H:\Program_Files\QuantLib\QuantLibC++\QuantLib-1.0.1\Testing_QuantLib\Makefile.win"
> Führt  make... aus
> make.exe -f
> "H:\Program_Files\QuantLib\QuantLibC++\QuantLib-1.0.1\Testing_QuantLib\Makefile.win"
> all
> g++.exe -c Testing_QuantLib_main.cpp -o Testing_QuantLib_main.o
> -I"lib/gcc/mingw32/3.4.2/include"  -I"include/c++/3.4.2/backward"
> -I"include/c++/3.4.2/mingw32"  -I"include/c++/3.4.2"  -I"include"
> -I"H:/Program_Files/QuantLib/boost/boost_1_47_0"
> -I"H:/Program_Files/QuantLib/QuantLibC++/QuantLib-1.0.1"
> g++.exe Testing_QuantLib_main.o  -o "Testing_QuantLib.exe" -L"lib"
> -L"H:/Program_Files/QuantLib/boost/boost_1_47_0/stage/lib"
> -L"H:/Program_Files/QuantLib/QuantLibC++/QuantLib-1.0.1/lib"
> Testing_QuantLib_main.o(.rdata$_ZTCN8QuantLib25ZeroSpreadedTermStructureE0_NS_18ZeroYieldStructureE[construction
> vtable for
> QuantLib::ZeroYieldStructure-in-QuantLib::ZeroSpreadedTermStructure]+0x24):Testing_QuantLib_main.cpp:
> undefined reference to `QuantLib::TermStructure::referenceDate() const'
>
>
>
> ------------------------------------------------------------------------------
> Virtualization & Cloud Management Using Capacity Planning
> Cloud computing makes use of virtualization - but cloud computing
> also focuses on allowing computing to be delivered as a service.
> http://www.accelacomm.com/jaw/sfnl/114/51521223/
> _______________________________________________
> QuantLib-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/quantlib-users
>

------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users