PeterTokeHedenAhlgren
asked on
How to get around error LNK2005
As I have found out, there ar e several reasons one might experience error LNK2005.
In my case I have an MFC project, and a "standard" C++ project, the latter being a library of many different functions. Since I'm working a lot with templates, almost all my code in this library is in header files.
Now I'd like to use one of my classes from the library in the MFC project. Including that file in CMyDoc.h results in several error LNK2005 messages such as.
"1>SeriesView.obj : error LNK2005: "void __cdecl ASU::start_timer(class boost::timer &)" (?start_timer@ASU@@YAXAAVt imer@boost @@@Z) already defined in ASU Studio.obj"
The function start_timer looks like this
void __declspec(dllexport) start_timer(boost::timer &aT) { aT.restart(); }
How do I get around having this header included by all .cpp files that by some "cross-reference" include CMyDoc.h?
I hope you guys can help me out on this. Thanks in advance!!!
In my case I have an MFC project, and a "standard" C++ project, the latter being a library of many different functions. Since I'm working a lot with templates, almost all my code in this library is in header files.
Now I'd like to use one of my classes from the library in the MFC project. Including that file in CMyDoc.h results in several error LNK2005 messages such as.
"1>SeriesView.obj : error LNK2005: "void __cdecl ASU::start_timer(class boost::timer &)" (?start_timer@ASU@@YAXAAVt
The function start_timer looks like this
void __declspec(dllexport) start_timer(boost::timer &aT) { aT.restart(); }
How do I get around having this header included by all .cpp files that by some "cross-reference" include CMyDoc.h?
I hope you guys can help me out on this. Thanks in advance!!!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER