Cygwin

I realize this has probably been asked a million times however, I saw no way
of searching the archives and google turned up nothing. I am trying to get
SDL apps to compile under cygwin. I’ve been able to get it to work under
linux and windows using Dev-C++ but no luck through cygwin on windows. I
downloaded and source and did a build. I then had to move my SDL includes
into usr/include because the build put them in the wrong place. I also had
to move the lib files so that linking worked. But I can’t get rid of the
_WinMain at 16 error.

Any suggestions?

Thanks.

Gregg

Gregg D Bolinger wrote:

I realize this has probably been asked a million times however, I saw
no way of searching the archives and google turned up nothing. I am
trying to get SDL apps to compile under cygwin. I’ve been able to get
it to work under linux and windows using Dev-C++ but no luck through
cygwin on windows. I downloaded and source and did a build. I then
had to move my SDL includes into usr/include because the build put
them in the wrong place. I also had to move the lib files so that
linking worked. But I can’t get rid of the _WinMain at 16 error.

This is a FAQ:

Q: I get "Undefined reference to ‘WinMain at 16’"
build environments including Dev-C++, you need to link with the output
of “sdl-config --libs”, which is usually: -lmingw32 -lSDLmain -lSDL
-mwindows

(from http://www.libsdl.org/faq.php?action=listentries&category=4#58)

I had the same problem with MinGW/MSYS the other day and it turned out I
was linking in the wrong order (I was using "-lSDLmain -lSDL -lmingw32"
and it didn’t work). Hope that helps.

By the way, you can search the list archives through Gmane’s web
interface at http://news.gmane.org/gmane.comp.lib.sdl

-graueA: Under Visual C++, you need to link with SDLmain.lib. Under the gcc

I also had to move the lib files so that linking worked. But I can’t get rid of the _WinMain at 16 error.
Any suggestions?
Thanks.
Gregg

Yesterday I also had problems with missing _WinMain at 16 error, but they disappeared when I tried compiling with -lSDL and -lSDLmain. Worth trying :slight_smile:

Koshmaar

I also had to move the lib files so that linking worked. But I can’t get rid of the _WinMain at 16 error.
Any suggestions?
Thanks.
Gregg

Yesterday I also had problems with missing _WinMain at 16 error, but they disappeared when I tried compiling with -lSDL and -lSDLmain. Worth trying :slight_smile:

Koshmaar

I’ve not used cygwin but for Dev-C++ not only do you have to have
-lmingw32 -lSDLmain -lSDL, but having -lmingw32 first is also key (as
someone previously mentioned). If you leave out either -lmingw32 or
-lSDLmain you will get the error you’ve been getting; you’ll also get it
if -lmingw32 isn’t first. -mwindows isn’t required, but you’ll probably
get a console window running the program if you don’t use it, and it has
to be at the end of the list as far as I can tell…

Matt

I have read that faq and links that have been suggested. compiling with
-SDLmain did not help. When linking with -lmingw32 g++ in cygwin can’t find
it.

As far as where the headers and libs were installed

/usr/local/include
/user/local/lib

Where they needed to be:

/user/include
/lib

that is where all my other headers and libs exist from the standard cygwin
install.

GreggOn 7/17/05, Koshmaar wrote:

I also had to move the lib files so that linking worked. But I can’t get
rid of the _WinMain at 16 error.
Any suggestions?
Thanks.
Gregg

Yesterday I also had problems with missing _WinMain at 16 error, but they
disappeared when I tried compiling with -lSDL and -lSDLmain. Worth trying
:slight_smile:

Koshmaar


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

As I said, g++ on cygwin can’t find mingw32 when linking.

GreggOn 7/17/05, Matthew Hurne <matthew.hurne at gmail.com> wrote:

I also had to move the lib files so that linking worked. But I can’t get
rid of the _WinMain at 16 error.

Any suggestions?
Thanks.
Gregg

Yesterday I also had problems with missing _WinMain at 16 error, but they
disappeared when I tried compiling with -lSDL and -lSDLmain. Worth trying
:slight_smile:

Koshmaar

I’ve not used cygwin but for Dev-C++ not only do you have to have
-lmingw32 -lSDLmain -lSDL, but having -lmingw32 first is also key (as
someone previously mentioned). If you leave out either -lmingw32 or
-lSDLmain you will get the error you’ve been getting; you’ll also get it
if -lmingw32 isn’t first. -mwindows isn’t required, but you’ll probably
get a console window running the program if you don’t use it, and it has
to be at the end of the list as far as I can tell…

Matt


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

Also note that cygwin does not have the libming32.a in the lib folder with
all the rest. I didn’t think that cygwin used mingw. So it would be
pointless to link to it. I guess I’ll try and install gcc for windows
(mingw) and not even use cygwin.

GreggOn 7/17/05, Gregg D Bolinger <@Gregg_D_Bolinger> wrote:

As I said, g++ on cygwin can’t find mingw32 when linking.

Gregg

On 7/17/05, Matthew Hurne <matthew.hurne at gmail.com> wrote:

I also had to move the lib files so that linking worked. But I can’t
get rid of the _WinMain at 16 error.

Any suggestions?
Thanks.
Gregg

Yesterday I also had problems with missing _WinMain at 16 error, but they
disappeared when I tried compiling with -lSDL and -lSDLmain. Worth trying
:slight_smile:

Koshmaar

I’ve not used cygwin but for Dev-C++ not only do you have to have
-lmingw32 -lSDLmain -lSDL, but having -lmingw32 first is also key (as
someone previously mentioned). If you leave out either -lmingw32 or
-lSDLmain you will get the error you’ve been getting; you’ll also get it
if -lmingw32 isn’t first. -mwindows isn’t required, but you’ll probably
get a console window running the program if you don’t use it, and it has

to be at the end of the list as far as I can tell…

Matt


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

Gregg D Bolinger wrote:

Also note that cygwin does not have the libming32.a in the lib folder
with all the rest. I didn’t think that cygwin used mingw. So it
would be pointless to link to it.

-lcygwin?

-graue

Gregg D Bolinger wrote:

I realize this has probably been asked a million times however, I saw
no way of searching the archives and google turned up nothing. I am
trying to get SDL apps to compile under cygwin. I’ve been able to get
it to work under linux and windows using Dev-C++ but no luck through
cygwin on windows. I downloaded and source and did a build. I then
had to move my SDL includes into usr/include because the build put
them in the wrong place. I also had to move the lib files so that
linking worked. But I can’t get rid of the _WinMain at 16 error.

Any suggestions?

If you are using DevCpp, setting up an SDL project is easy. Be sure to
get the SDL and OpenGL Package using DevCpp’s internal package update
system. Then you just have choose :

File -> New -> Project

Then check the “Multimedia Tab” and choose “SDL” or “SDL with GL”.

Now you have a small “Hellow world”-type of program and everything is
set up correctly.
You will get more of those template projects when you install other
packages as well.

Cheers :slight_smile:

Also note that cygwin does not have the libming32.a in the lib folder with
all the rest. I didn’t think that cygwin used mingw. So it would be
pointless to link to it. I guess I’ll try and install gcc for windows
(mingw) and not even use cygwin.

The cygwin install program has the option of installing mingw stuff so
that you can have a cygwin environment and compile for it or for Win32
without the need for cygwin. mingw libraries are put in their own
directory (mingw) under the directory with the cygwin libraries. SDL seems
to insist on using mingw to avoid using cygwin when built on Windows with
cygwin. I’m using the cygwin with mingw setup along with SDL and it works
for me.

Also, I never could figure out the proper linking order for all the
libraries I need. I find it quite obnoxious that the order can prevent
linking on Windows but doesn’t matter on Linux. So I gave up worrying
about it. I use a special makefile for cygwin/mingw that tells gcc to
compile and link everything in the same command. It limits the usefulness
of a makefile, but I no longer have to spend time figuring out how to work
around something that looks like it’s broken.On Sun, 17 Jul 2005, Gregg D Bolinger wrote:


Jeff Jackowski
http://ro.com/~jeffj/