CMake > Code::Blocks Fail!

Compiling, Linking, and Debugging C++ Box2D
Wahooney
Posts: 155
Joined: Tue Sep 18, 2007 6:17 am
Location: Western Cape, South Africa
Contact:

CMake > Code::Blocks Fail!

Postby Wahooney » Tue Feb 16, 2010 10:08 am

I get the following errors when trying to build after generating a Code::Blocks project using cmake:

||=== Box2D, Testbed ===|
..\freeglut\libfreeglut_static.a(freeglut_main.c.obj)freeglut_main.c|| undefined reference to `timeGetTime@0'|
..\freeglut\libfreeglut_static.a(freeglut_init.c.obj)freeglut_init.c|| undefined reference to `timeBeginPeriod@4'|
..\freeglut\libfreeglut_static.a(freeglut_init.c.obj)freeglut_init.c|| undefined reference to `timeEndPeriod@4'|
..\freeglut\libfreeglut_static.a(freeglut_joystick.c.obj)freeglut_joystick.c|| undefined reference to `joyGetPosEx@8'|
..\freeglut\libfreeglut_static.a(freeglut_joystick.c.obj)freeglut_joystick.c|| undefined reference to `joyGetDevCapsA@12'|
||=== Build finished: 5 errors, 0 warnings ===|

Anyone have any ideas?

Thanks.

Erin Catto
Site Admin
Posts: 2948
Joined: Thu Sep 06, 2007 12:34 am

Re: CMake > Code::Blocks Fail!

Postby Erin Catto » Tue Feb 16, 2010 10:50 am

I don't run Code Blocks, so I'm depending on community input to adapt the Cmake files to other environments.

Wahooney
Posts: 155
Joined: Tue Sep 18, 2007 6:17 am
Location: Western Cape, South Africa
Contact:

Re: CMake > Code::Blocks Fail!

Postby Wahooney » Tue Feb 16, 2010 12:53 pm

Ah, gotcha. I don't know the first thing about cmake (besides the actual making) or the error being raised.

Any collaborators?

Paril
Posts: 236
Joined: Mon Jul 27, 2009 6:46 am

Re: CMake > Code::Blocks Fail!

Postby Paril » Tue Feb 16, 2010 1:07 pm

timeGetTime and likewise functions require winmm.lib to be linked.
If this isn't a Windows build, you did something horribly wrong, as these are Windows API functions.
Generally this is due to the wrong preprocessor definition for the OS, or the lib assuming that nothing set means Windows.

Google result: http://msdn.microsoft.com/en-us/library ... 85%29.aspx

-P

Ardaen
Posts: 1
Joined: Sun Mar 28, 2010 8:58 pm

Re: CMake > Code::Blocks Fail!

Postby Ardaen » Sun Mar 28, 2010 9:06 pm

Just in case it'll help someone, here is a simple update to the cmake files to let testbed build under Code::Blocks.

Edit: and by that I mean Code::Blocks on windows using Mingw32
Attachments
codeblockc-cmake-fix.patch
(583 Bytes) Downloaded 462 times

Olof Larsson
Posts: 3
Joined: Sun Apr 04, 2010 3:24 am

Re: CMake > Code::Blocks Fail!

Postby Olof Larsson » Fri May 07, 2010 9:09 am

I am running windows 7 with Eclipse and MinGW. I had the very same problem and solved it in a way similar to your patch.

I made a change in Box2D\Testbed\CMakeLists.txt
this way:

FROM:

Code: Select all

target_link_libraries (
   Testbed
   Box2D
   freeglut_static
   glui
   ${OPENGL_LIBRARIES}
)


TO:

Code: Select all

target_link_libraries (
   Testbed
   Box2D
   freeglut_static
   glui
   winmm
   ${OPENGL_LIBRARIES}
)


I simply added winmm and then it linked successfully :D

tagada
Posts: 1
Joined: Mon May 23, 2011 11:48 am

Re: CMake > Code::Blocks Fail!

Postby tagada » Mon May 23, 2011 11:58 am

Confirm it. It is compiling and working for me on win7 with codeblock.


Return to “Build Issues”



Who is online

Users browsing this forum: No registered users and 0 guests