CodeBlocks: keep getting 'undefined reference to...'

C, C++, and Visual C++
autofasurer
Phidgetsian
Posts: 12
Joined: Sat May 16, 2015 4:45 am
Contact:

CodeBlocks: keep getting 'undefined reference to...'

Postby autofasurer » Tue Jul 07, 2015 7:19 am

Hi all,

I'm trying to get this https://github.com/autofasurer/ofxPhidgetEncoder to work in CodeBlocks on windows 7, but I keep on getting this type of errors for every CPhidget function:

Code: Select all

undefined reference to '_imp__CPhidgetEncoder_getPosittion@12'
undefined reference to '_imp__CPhidget_getDeviceName@8'
...


I've been at this for almost a day and I don't know what else I can try... I've been linking to the 32bit and 64bit .libs, adding the phidget21.h file to the project, the .lib file to the project, adding the .lib path to the linker settings,... but somehow I still get these errors...
What's not being found?!

I've found some references to this problem but no posted solutions... if anyone can help that would be fantastic. I've got tons of stuff to port from an osx project and this is only the first thing and I'm already stuck... :?

autofasurer
Phidgetsian
Posts: 12
Joined: Sat May 16, 2015 4:45 am
Contact:

Re: CodeBlocks: keep getting 'undefined reference to...'

Postby autofasurer » Tue Jul 07, 2015 8:07 am

Well... as seems to be so frequently the case the moment one seeks help, the solution presents itself.

  • The library needs to be the 32bit one (I don't know why).
  • In menu Settings > Compiler..., the tab 'Linker Settings' I've added the library (c:\program files\Phidgets\x86\phidget21.lib)
  • I've copied the phidget21.h file into the src directory of the openframeworks project.
  • added the phidget21.h file from that directory to the project
  • in menu Settings > Compiler..., the tab 'Search directories', I've added the path to this phidget21.h file (don't ask me why, but without it and only adding the file to the project kept generating 'file not found' errors. )

That seems to have done the trick. After that I've added a new compiler flag (menu > Settings > Compiler... > tab Compiler Settings / compiler flags: [-fpermissive] to get rid of the __stdcall errors.

It all works now, fixing the call convention thing will be for later (although I thought that was being handled in the phidget library with CCONV)


Return to “C/C++”

Who is online

Users browsing this forum: No registered users and 3 guests