Can't compile under Windows but under Linux

Hello,

I can compile a OpenGL application just fine doing so:

g++ -std=c++11 -o main Main.cpp FastNoise.cpp shader.cpp texture.cpp libglfw3.a lib
GLEW.a -Wl,-Bdynamic -lGL -lGLU -lX11 -lXxf86vm -lXrandr -lpthread -lXi -ldl -lXinerama -lXcursor

But if I compile it like this:

g++.exe -std=c++11 -o main Main.cpp FastNoise.cpp shader.cpp texture.cpp libglfw3.a lib
GLEW.a

Then I get tons of undefined reference errors. I have tried doing this under Ubuntu with MinGw64 and under Windows with MinGw and g++. I had the same issue under Visual Studio and I fixed it by adding this praeprocessor defintions:
WIN32
_WINDOWS
TW_STATIC
TW_NO_LIB_PRAGMA
TW_NO_DIRECT3D
GLEW_STATIC
_CRT_SECURE_NO_WARNINGS
CMAKE_INTDIR=“Debug”

Is there any way to tell MinGw to use those praeprocessor defintions?

Building command-line on Windows can definitely be a pain compared to Linux, due to flavor-of-the-month MSVS environment and other build environments.

To make it easy, I’d recommend that you just use CMake. Then you can use the same build config across Linux and all the myriad build environments for Windows, often with little to no change on your part, hiding most of that platform-specific voodoo.

Here’s a simple example that should build/run on Windows and Linux you can play with if you’d like to try it out.

[QUOTE=Dark Photon;1289021]Building command-line on Windows can definitely be a pain compared to Linux, due to flavor-of-the-month MSVS environment and other build environments.

To make it easy, I’d recommend that you just use CMake. Then you can use the same build config across Linux and all the myriad build environments for Windows, often with little to no change on your part, hiding most of that platform-specific voodoo.

Here’s a simple example that should build/run on Windows and Linux you can play with if you’d like to try it out.[/QUOTE]

I actually ended up making a CMake myself yesterday on my own. But I’m not sure how to compile for Windows the best way. Currently I’m using the CMakeGUI to create a new Visual Studio Project and use the builded .exe from the VS project. Is there any way to directy build a .exe from CMake? Also I managed to make a .exe with the g++.exe but sadly it shows me a error that a EntryPoint hasn’t been found. More details are on stackoverflow.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.