Cygwin/GLEW/SDL2 with some compiling issues

I was able to compile GLEW in my cygwin environment with a little
struggling, so then I went on to try and compile a game engine I’m working
on. My engine compiles fine, but when I try and to compile my first
example, I get this lovely error:

/usr/local/bin/c++.exe -Wl,–enable-auto-import
CMakeFiles/bear_test1.dir/tests/test1.cpp.o -o bear_test1.exe
-Wl,–out-implib,libbear_test1.dll. a
-Wl,–major-image-version,0,–minor-image-version,0
-L/home/Alex/bear-engine/bin -L/home/Alex/bear-engine/lib -lSDL2main
-lGLEW -lGL -lSDL2 libbear _core.a -lGLEW -lGL -lSDL2
/usr/lib/libcygwin.a(libcmain.o): In function main': /usr/src/debug/cygwin-1.7.17-1/winsup/cygwin/lib/libcmain.c:39: undefined reference to_WinMain at 16’

Here is my cmake file https://gist.github.com/mrozbarry/5044255, which
hopefully can shed some light on things

I am using gcc 4.7.2, which I have had some issues when it comes to linking
in the past.

Thanks for the help,
-Alex

Shouldn’t this

LIST (APPEND CMAKE_CXX_FLAGS "-mwindows")

set for Cygwin too?
Also you could try adding WIN32 in add_executable() which pulls in a few
flags for better windows support (-mwindows among them).

VittorioSent from my iPad Mini

On 27/feb/2013, at 02:59, Alex Barry <alex.barry at gmail.com> wrote:

I was able to compile GLEW in my cygwin environment with a little
struggling, so then I went on to try and compile a game engine I’m working
on. My engine compiles fine, but when I try and to compile my first
example, I get this lovely error:

/usr/local/bin/c++.exe -Wl,–enable-auto-import
CMakeFiles/bear_test1.dir/tests/test1.cpp.o -o bear_test1.exe
-Wl,–out-implib,libbear_test1.dll. a
-Wl,–major-image-version,0,–minor-image-version,0
-L/home/Alex/bear-engine/bin -L/home/Alex/bear-engine/lib -lSDL2main
-lGLEW -lGL -lSDL2 libbear _core.a -lGLEW -lGL -lSDL2
/usr/lib/libcygwin.a(libcmain.o): In function main': /usr/src/debug/cygwin-1.7.17-1/winsup/cygwin/lib/libcmain.c:39: undefined reference to_WinMain at 16’

Here is my cmake file https://gist.github.com/mrozbarry/5044255, which
hopefully can shed some light on things

I am using gcc 4.7.2, which I have had some issues when it comes to linking
in the past.

Thanks for the help,
-Alex


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Ah, I found the problem - I was setting the
define ADD_DEFINITIONS("-Dmain=SDL_main") which caused the problem. I
don’t recall where I found information to use that define while compiling
SDL apps, but it seems to mess things up =/

Anyway, problem solved for now - it seems -mwindows isn’t required for
compiling, but I can make sure that is set, just in case.

Thanks for the help :)On Sun, Mar 3, 2013 at 8:09 AM, Vittorio Giovara <vittorio.giovara at gmail.com wrote:

Shouldn’t this

LIST (APPEND CMAKE_CXX_FLAGS “-mwindows”)

set for Cygwin too?
Also you could try adding WIN32 in add_executable() which pulls in a few
flags for better windows support (-mwindows among them).

Vittorio

Sent from my iPad Mini

On 27/feb/2013, at 02:59, Alex Barry <@Alex_Barry> wrote:

I was able to compile GLEW in my cygwin environment with a little
struggling, so then I went on to try and compile a game engine I’m working
on. My engine compiles fine, but when I try and to compile my first
example, I get this lovely error:

/usr/local/bin/c++.exe -Wl,–enable-auto-import
CMakeFiles/bear_test1.dir/tests/test1.cpp.o -o bear_test1.exe
-Wl,–out-implib,libbear_test1.dll. a
-Wl,–major-image-version,0,–minor-image-version,0
-L/home/Alex/bear-engine/bin -L/home/Alex/bear-engine/lib -lSDL2main
-lGLEW -lGL -lSDL2 libbear _core.a -lGLEW -lGL -lSDL2
/usr/lib/libcygwin.a(libcmain.o): In function main': /usr/src/debug/cygwin-1.7.17-1/winsup/cygwin/lib/libcmain.c:39: undefined reference to_WinMain at 16’

Here is my cmake file https://gist.github.com/mrozbarry/5044255, which
hopefully can shed some light on things

I am using gcc 4.7.2, which I have had some issues when it comes to
linking in the past.

Thanks for the help,
-Alex


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org