error LNK2019 with oF 0.06

Hi all ! Long time user/reader, first time participant here.

I have some trouble concerning a linking error under Visual Studio 2008 Express with oF 0.06. For example, if I copy an addon example from the /addonsExample folder and add a _ofxPoint2f _attribute to the _testApp _class, I get errors saying :

error LNK2019: unresolved external symbol

It also happens if I try to use attributes in other classes, like so:

[…]
1>Generating Code…
1>Compiling manifest to resources…
1>Microsoft ® Windows ® Resource Compiler Version 6.1.6723.1
1>Copyright © Microsoft Corporation. All rights reserved.
1>Linking…
1>BoxAligner.obj : error LNK2019: unresolved external symbol “public: __thiscall ofxPoint2f::ofxPoint2f(float,float)” (??0ofxPoint2f@@QAE@MM@Z) referenced in function “public: __thiscall BoxAligner::BoxAligner(void)” (??0BoxAligner@@QAE@XZ)
1>bin\opencvExample_debug.exe : fatal error LNK1120: 1 unresolved externals

I have included “…\addons\ofxVectorMath\src” under “Additional Include Directories” for both the Debug and Release settings, without any change.

The same thing also happens if I try to build the _ofxSimpleGuiToo _sample code :

1>Linking…
1>testApp.obj : error LNK2019: unresolved external symbol “public: void __thiscall ofxSimpleGuiToo::show(void)” (?show@ofxSimpleGuiToo@@QAEXXZ) referenced in function “public: virtual void __thiscall testApp::setup(void)” (?setup@testApp@@UAEXXZ)
1>testApp.obj : error LNK2019: unresolved external symbol “public: void __thiscall ofxSimpleGuiToo::loadFromXML(void)” (?loadFromXML@ofxSimpleGuiToo@@QAEXXZ) referenced in function “public: virtual void __thiscall testApp::setup(void)” (?setup@testApp@@UAEXXZ)
1>testApp.obj : error LNK2019: unresolved external symbol “public: class ofxSimpleGuiPage & __thiscall ofxSimpleGuiToo::addPage(class std::basic_string<char,struct std::char_traits,class std::allocator >)” (?addPage@ofxSimpleGuiToo@@QAEAAVofxSimpleGuiPage@@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) referenced in function “public: virtual void __thiscall testApp::setup(void)” (?setup@testApp@@UAEXXZ)
[…]

Maybe I’m missing an obvious step, but when I try using Visual Studio 2005 Express with oF 0.05 everything is fine. Any idea ?

Have a great holiday season !

  • Phil

I think the problem is that you are adding the search paths for the header files but not telling VS to actually compile the files. To do that you have to actually add the cpp files to the project so that they show up in the sidebar.

I think you need to go to the
menu bar -> project -> add existing item …

Aaaah ! Thanks !

I added a /otherLibs folder to the /addons, /libs and /src structure, containing some needed addons, and it solved the problem.

Drinks on me ! :slight_smile:

[quote author=“fyll_s”]Aaaah ! Thanks !

I added a /otherLibs folder to the /addons, /libs and /src structure, containing some needed addons, and it solved the problem.

Drinks on me ! :)[/quote]

I had the same issue and followed your suggestion and added another folder in my project library with all required addons for my project. I then created a new filter in my VS2008 project and dragged all cpps from all addons in that filter. Is that what you did? Compiles now.

Cheers

Yes, that’s exactly what I did. I hope this issue will be dealt with in a next release, because it seems a bit awkward to included much needed librairies that often… of course, it’s also possible to just add them once to the _emptyExample _and stop thinking about it.

Thanks for the reply!

That’s probably the best solution, but you will still have to (well should for cleanness) remove the unnecessary addons. At least it works now :smiley:

Very true.

Take care !