# Compiles for Linux but not Windows (linker error)

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

## 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 on other sites
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.

1. 1
2. 2
Rutin
19
3. 3
4. 4
5. 5

• 14
• 12
• 9
• 12
• 37
• ### Forum Statistics

• Total Topics
631434
• Total Posts
3000050
×