LNK2005 error

This forum is to discuss the book "C++ design patterns and derivatives pricing."

LNK2005 error

Postby efvmcm » Fri Jul 26, 2013 4:10 pm

I am trying to build the code for the first time in Visual Studio 2010. I am getting lots of LNK2005 errors saying that objects are already defined, such as

>PayOff3.obj : error LNK2005: "public: __thiscall PayOffCall::PayOffCall(double)" (??0PayOffCall@@QAE@N@Z) already defined in PayOff2.obj
1>PayOff3.obj : error LNK2005: "public: virtual double __thiscall PayOffCall::operator()(double)const " (??RPayOffCall@@UBENN@Z) already defined in PayOff2.obj
1>PayOff3.obj : error LNK2005: "public: virtual double __thiscall PayOffPut::operator()(double)const " (??RPayOffPut@@UBENN@Z) already defined in PayOff2.obj
1>PayOff3.obj : error LNK2005: "public: __thiscall PayOffPut::PayOffPut(double)" (??0PayOffPut@@QAE@N@Z) already defined in PayOff2.obj

I might be able to fix this by going through each one and use the Nameless Namespace, but I was wondering if there is a quicker/global fix?
efvmcm
 
Posts: 1
Joined: Fri Jul 26, 2013 4:07 pm

Re: LNK2005 error

Postby mj » Mon Jul 29, 2013 12:47 am

it may be confusing objects from different version of vs

try doing a rebuild all

i've never tried building with 2010 but i'd be amazed if the code needed changing.
mj
Site Admin
 
Posts: 1380
Joined: Fri Jul 27, 2007 7:21 am


Return to C++ design patterns and derivatives pricing

Who is online

Users browsing this forum: No registered users and 1 guest

cron