Silly linker question

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

Silly linker question

Grześ Andruszkiewicz
Hi,

I have some blackout currently... I just added a test project to my
solution, but it fails to link:
1>------ Rebuild All started: Project: CatBonds, Configuration:
Release Win32 ------
1>  CatBond.cpp
1>  catcoupon.cpp
1>  CatRisk.cpp
1>  Main.cpp
1>  riskynotional.cpp
1>  Generating code
1>  Finished generating code
1>  CatBonds.vcxproj ->
C:\Users\ga\Documents\dev\imperial\Oasis\Release\CatBonds.exe
2>------ Rebuild All started: Project: Test, Configuration: Release Win32 ------
2>  catrisktests.cpp
2>  exampletests.cpp
2>  testrunner.cpp
2>catrisktests.obj : error LNK2001: unresolved external symbol
"private: static long __cdecl QuantLib::Date::yearOffset(int)"
(?yearOffset@Date@QuantLib@@CAJH@Z)
2>catrisktests.obj : error LNK2001: unresolved external symbol
"private: static int __cdecl QuantLib::Date::monthOffset(enum
QuantLib::Month,bool)" (?monthOffset@Date@QuantLib@@CAHW4Month@2@_N@Z)
2>catrisktests.obj : error LNK2001: unresolved external symbol
"public: static bool __cdecl QuantLib::Date::isLeap(int)"
(?isLeap@Date@QuantLib@@SA_NH@Z)
2>catrisktests.obj : error LNK2001: unresolved external symbol
"public: int __thiscall QuantLib::Date::year(void)const "
(?year@Date@QuantLib@@QBEHXZ)
2>catrisktests.obj : error LNK2001: unresolved external symbol
"public: enum QuantLib::Month __thiscall
QuantLib::Date::month(void)const "
(?month@Date@QuantLib@@QBE?AW4Month@2@XZ)
2>catrisktests.obj : error LNK2001: unresolved external symbol
"public: __thiscall QuantLib::Date::Date(void)"
(??0Date@QuantLib@@QAE@XZ)
2>catrisktests.obj : error LNK2001: unresolved external symbol
"public: __thiscall QuantLib::Date::Date(int,enum
QuantLib::Month,int)" (??0Date@QuantLib@@QAE@HW4Month@1@H@Z)
2>C:\Users\ga\Documents\dev\imperial\Oasis\Release\Test.exe : fatal
error LNK1120: 7 unresolved externals
========== Rebuild All: 1 succeeded, 1 failed, 0 skipped ==========

It seems to have the same library paths as the first project that
works... What am I missing?


Cheers,
Grzegorz

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_jan
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev
Reply | Threaded
Open this post in threaded view
|

Re: Silly linker question

Luigi Ballabio
Besides the library path, did you add the library itself? (It is done
implicitly if you add its project as a dependency; otherwise, you have
to add it in the linker options.)

Luigi

On Mon, Feb 4, 2013 at 3:46 PM, Grześ Andruszkiewicz <[hidden email]> wrote:

> Hi,
>
> I have some blackout currently... I just added a test project to my
> solution, but it fails to link:
> 1>------ Rebuild All started: Project: CatBonds, Configuration:
> Release Win32 ------
> 1>  CatBond.cpp
> 1>  catcoupon.cpp
> 1>  CatRisk.cpp
> 1>  Main.cpp
> 1>  riskynotional.cpp
> 1>  Generating code
> 1>  Finished generating code
> 1>  CatBonds.vcxproj ->
> C:\Users\ga\Documents\dev\imperial\Oasis\Release\CatBonds.exe
> 2>------ Rebuild All started: Project: Test, Configuration: Release Win32 ------
> 2>  catrisktests.cpp
> 2>  exampletests.cpp
> 2>  testrunner.cpp
> 2>catrisktests.obj : error LNK2001: unresolved external symbol
> "private: static long __cdecl QuantLib::Date::yearOffset(int)"
> (?yearOffset@Date@QuantLib@@CAJH@Z)
> 2>catrisktests.obj : error LNK2001: unresolved external symbol
> "private: static int __cdecl QuantLib::Date::monthOffset(enum
> QuantLib::Month,bool)" (?monthOffset@Date@QuantLib@@CAHW4Month@2@_N@Z)
> 2>catrisktests.obj : error LNK2001: unresolved external symbol
> "public: static bool __cdecl QuantLib::Date::isLeap(int)"
> (?isLeap@Date@QuantLib@@SA_NH@Z)
> 2>catrisktests.obj : error LNK2001: unresolved external symbol
> "public: int __thiscall QuantLib::Date::year(void)const "
> (?year@Date@QuantLib@@QBEHXZ)
> 2>catrisktests.obj : error LNK2001: unresolved external symbol
> "public: enum QuantLib::Month __thiscall
> QuantLib::Date::month(void)const "
> (?month@Date@QuantLib@@QBE?AW4Month@2@XZ)
> 2>catrisktests.obj : error LNK2001: unresolved external symbol
> "public: __thiscall QuantLib::Date::Date(void)"
> (??0Date@QuantLib@@QAE@XZ)
> 2>catrisktests.obj : error LNK2001: unresolved external symbol
> "public: __thiscall QuantLib::Date::Date(int,enum
> QuantLib::Month,int)" (??0Date@QuantLib@@QAE@HW4Month@1@H@Z)
> 2>C:\Users\ga\Documents\dev\imperial\Oasis\Release\Test.exe : fatal
> error LNK1120: 7 unresolved externals
> ========== Rebuild All: 1 succeeded, 1 failed, 0 skipped ==========
>
> It seems to have the same library paths as the first project that
> works... What am I missing?
>
>
> Cheers,
> Grzegorz
>
> ------------------------------------------------------------------------------
> Everyone hates slow websites. So do we.
> Make your web apps faster with AppDynamics
> Download AppDynamics Lite for free today:
> http://p.sf.net/sfu/appdyn_d2d_jan
> _______________________________________________
> QuantLib-dev mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/quantlib-dev

------------------------------------------------------------------------------
Free Next-Gen Firewall Hardware Offer
Buy your Sophos next-gen firewall before the end March 2013
and get the hardware for free! Learn more.
http://p.sf.net/sfu/sophos-d2d-feb
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev
Reply | Threaded
Open this post in threaded view
|

Re: Silly linker question

Grześ Andruszkiewicz
Hi,

Thanks for your replies, I found it finally! Indeed as Peter suggested
the autolinker thing was missing, so adding:
#include <ql/auto_link.hpp>

to the main file fixed the issue. In the project that worked Lorenzo
added the whole #include <ql/quantlib.hpp>, so I didn't even realize
that the autolinker was needed and that it was hidden inside it!


Cheers,
Grzegorz

On 6 February 2013 09:19, Luigi Ballabio <[hidden email]> wrote:

> Besides the library path, did you add the library itself? (It is done
> implicitly if you add its project as a dependency; otherwise, you have
> to add it in the linker options.)
>
> Luigi
>
> On Mon, Feb 4, 2013 at 3:46 PM, Grześ Andruszkiewicz <[hidden email]> wrote:
>> Hi,
>>
>> I have some blackout currently... I just added a test project to my
>> solution, but it fails to link:
>> 1>------ Rebuild All started: Project: CatBonds, Configuration:
>> Release Win32 ------
>> 1>  CatBond.cpp
>> 1>  catcoupon.cpp
>> 1>  CatRisk.cpp
>> 1>  Main.cpp
>> 1>  riskynotional.cpp
>> 1>  Generating code
>> 1>  Finished generating code
>> 1>  CatBonds.vcxproj ->
>> C:\Users\ga\Documents\dev\imperial\Oasis\Release\CatBonds.exe
>> 2>------ Rebuild All started: Project: Test, Configuration: Release Win32 ------
>> 2>  catrisktests.cpp
>> 2>  exampletests.cpp
>> 2>  testrunner.cpp
>> 2>catrisktests.obj : error LNK2001: unresolved external symbol
>> "private: static long __cdecl QuantLib::Date::yearOffset(int)"
>> (?yearOffset@Date@QuantLib@@CAJH@Z)
>> 2>catrisktests.obj : error LNK2001: unresolved external symbol
>> "private: static int __cdecl QuantLib::Date::monthOffset(enum
>> QuantLib::Month,bool)" (?monthOffset@Date@QuantLib@@CAHW4Month@2@_N@Z)
>> 2>catrisktests.obj : error LNK2001: unresolved external symbol
>> "public: static bool __cdecl QuantLib::Date::isLeap(int)"
>> (?isLeap@Date@QuantLib@@SA_NH@Z)
>> 2>catrisktests.obj : error LNK2001: unresolved external symbol
>> "public: int __thiscall QuantLib::Date::year(void)const "
>> (?year@Date@QuantLib@@QBEHXZ)
>> 2>catrisktests.obj : error LNK2001: unresolved external symbol
>> "public: enum QuantLib::Month __thiscall
>> QuantLib::Date::month(void)const "
>> (?month@Date@QuantLib@@QBE?AW4Month@2@XZ)
>> 2>catrisktests.obj : error LNK2001: unresolved external symbol
>> "public: __thiscall QuantLib::Date::Date(void)"
>> (??0Date@QuantLib@@QAE@XZ)
>> 2>catrisktests.obj : error LNK2001: unresolved external symbol
>> "public: __thiscall QuantLib::Date::Date(int,enum
>> QuantLib::Month,int)" (??0Date@QuantLib@@QAE@HW4Month@1@H@Z)
>> 2>C:\Users\ga\Documents\dev\imperial\Oasis\Release\Test.exe : fatal
>> error LNK1120: 7 unresolved externals
>> ========== Rebuild All: 1 succeeded, 1 failed, 0 skipped ==========
>>
>> It seems to have the same library paths as the first project that
>> works... What am I missing?
>>
>>
>> Cheers,
>> Grzegorz
>>
>> ------------------------------------------------------------------------------
>> Everyone hates slow websites. So do we.
>> Make your web apps faster with AppDynamics
>> Download AppDynamics Lite for free today:
>> http://p.sf.net/sfu/appdyn_d2d_jan
>> _______________________________________________
>> QuantLib-dev mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/quantlib-dev

------------------------------------------------------------------------------
Free Next-Gen Firewall Hardware Offer
Buy your Sophos next-gen firewall before the end March 2013
and get the hardware for free! Learn more.
http://p.sf.net/sfu/sophos-d2d-feb
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev