kylemcdonald/ofxFaceTracker

unresolved symbol trackingDistance still exists

vertgo opened this issue · 3 comments

I know this used to be a problem for people in older versions of this library, but if I download the latest 0.9.0 ofx release, clone faceTracker and ofxCV into the addons, and use project generator to generate a new project with ofxCV, ofxFaceTracker and ofxOpenCv, i still get this error on compile of an otherwise empty project. Those are all the steps necessary. I'm using visualStudio 2015

For what it's worth, I have no such problem on mac

I spent hours last night trying to figure it out.

I think most of us ended up finding that issue after googling for the error message.

It usually points you to this stackoverflow answer. It's actually pointing in the right direction, but changing the properties for the entire project didn't work for me.

What DID work, though, was to apply this setting only on some files:

In the Solution Explorer, go to your project > addons > ofxFaceTracker > libs > FaceTracker > src > lib.

There you'll find a series of .cc files, including Tracker.cc.

Select them all, right-click > Properties. In the Property page, go to Configuration Properties > C/C++ > Output Files

There, for Object File Name, replace $(IntDir) by $(IntDir)/%(RelativeDir)/

It worked for me for compiling FaceOSC (after adding the proper addons as well, ofxOsc & ofxXmlSettings were missing). From what I understood, the "unresolved symbol trackingDistance" issue comes from a confusion between ofxFaceTracker's Tracker and ofxCV's Tracker.

@kylemcdonald, what would be the best way to help Windows user compile ofxFaceTracker projects and/or FaceOSC? Add instructions in the readme? Share a Visual Studio solution?
It would also be great if we could add a Windows binary of FaceOSC back to https://github.com/kylemcdonald/ofxFaceTracker/releases ;) What do you think? How can we help?

Just ran into this myself. A very similar, but slightly less tedious fix, is to change the Output Files setting on the project itself, rather than on individual files, as in this post from StackOverflow. Modifying what was shared above:

In the Solution Explorer, right-click on your project > Properties. In the Property page, go to Configuration Properties > C/C++ > Output Files

There, for Object File Name, replace $(IntDir) by $(IntDir)/%(RelativeDir)/

In response to @yhancik's question about fixing the issues for Visual Studio, I would say that if there were project files, they could be fixed, but they've been removed in favor of using the projectGenerator to create the needed project files for whichever platform. I agree a short-term/easy solution would be to add some info to the README. I'm happy to put together a PR for this later.

Probably a better approach would be to have the projectGenerator create VS files with this change in the sln/vcxproj file (not sure which, I'd need to look into them). I'll open an issue for this later on as well.

I'm including these errors below so that others searching can find this issue easier since the issue title doesn't include them:
LNK2001 unresolved external symbol
Tracker.obj : warning LNK4042: object specified more than once; extras ignored

I ran into the same problem yesterday.
Suspecting it might be the way the compiler and linker interact in MSVS, I renamed the ofxCv Tracker.* files (not classes, they already have distinct enclosing namespaces) to ofxcv_Tracker.* and... voilà!
Not the first tine Microsoft's VC compiler screws up things... I've found that XCode / clang tends to be more flexible / functional.