Jump to content
  • Advertisement
Sign in to follow this  
Butterman

Compiles for Linux but not Windows (linker error)

This topic is 3816 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey. Ive been trying to implement Box2D (2D physics library) into my project. I have compiled the library from source for both windows and Linux. But i am having trouble linking the library into windows. (Note: I compile to windows using Mingw32 in Linux). I posted this all into the Box2D forums, but i dont think i will be getting a reply there anytime soon. Here is the post i made in those forums. ---------------------------------------------------------------------------- Hey all. I develop on Linux, and compile windows binaries from here using mingw32. I use GCC for all my compiling. I compiled Box2D for both linux and windows (.a and .so) put them in the correct folders, put the "-lbox2d" tag into my makefiles, and it worked fine. Until, i put this line of code in. From my understanding, this is the only line of code in my project that calls a function that *should be* in the Box2d library.
   pworld = new b2World(worldAABB, gravity, true);


at which point, it started coughing up compiler errors, (in the link stage). Note, that the linux version compiled fine, when i tried to compile for windows i got this
/tmp/ccJd63Hj.o:gmap.cpp:(.text+0x25b): undefined reference to `b2World::b2World(b2AABB const&, b2Vec2 const&, bool)'


So, im totally confused. Usually an error like this can be solved with changing the linking order in my makefiles, but not this time. Ill put my makefiles now. Windows
all:

    i586-mingw32msvc-g++ -o bin/win/BlackAurora.exe Source/*.cpp  -lmingw32 -lSDLmain -lSDL -lSDL_image -mwindows -lopengl32 -lbox2d


Linux
all:

   g++ -o bin/linux/BlackAurora Source/*.cpp -lbox2d -lSDL -lGL -lSDL_image


Im totally stumped here. Any help? ------------------------------------------------------------------------- Strange. Quote tags wont work....

Share this post


Link to post
Share on other sites
Advertisement
What happens if instead of the -l... option you put there the library file, with full path? If that works, it probably means your library path is not correctly set up.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!