Linux -> windows help required

Hallihall?,

I’ve done a school work, using SDL. The problem is that the lame
Computer teacher is scared of Linux and refuses to come within 10
meters of a Linux computer. So he demands that I compile it for
win95/NT.

I’ve downloaded, and installed. Mingw32, SDL and DirectX 5 SDK.
When trying to compile it looks like this:

C:\MINGW32\mingw32\bin>gcc -g -Wall -D_REENTRANT -O3 -
I\c:\mingw32\mingw32\inclu
de -o /spec3/Tower /spec3/NY3.c -L\c:\mingw32\mingw32\lib -lSDL
C:\MINGW32\MINGW32\BIN…\lib\gcc-lib\i386-mingw32\egcs-
2.91.60…\i386
-mingw32\lib\libmingw32.a(main.o)(.text+0x7b): undefined reference
to `WinMain at 1
6’

What am I doing wrong?

Hadriel

[Charset ISO-8859-1 unsupported, filtering to ASCII…]

Hallihall_,

I’ve done a school work, using SDL. The problem is that the lame
Computer teacher is scared of Linux and refuses to come within 10
meters of a Linux computer. So he demands that I compile it for
win95/NT.

I just wanted to point out how utterly and completely LAME that is. :slight_smile:
Good luck!

-bill!

I’ve downloaded, and installed. Mingw32, SDL and DirectX 5 SDK.
When trying to compile it looks like this:

C:\MINGW32\mingw32\bin>gcc -g -Wall -D_REENTRANT -O3 -
I\c:\mingw32\mingw32\inclu
de -o /spec3/Tower /spec3/NY3.c -L\c:\mingw32\mingw32\lib -lSDL
C:\MINGW32\MINGW32\BIN…\lib\gcc-lib\i386-mingw32\egcs-
2.91.60…\i386
-mingw32\lib\libmingw32.a(main.o)(.text+0x7b): undefined reference
to `WinMain at 1
6’

What am I doing wrong?

This is my cross-compiler link line:
/usr/win32/bin/gcc -o fire.exe fire.o -L…/…/SDL/lib -lmingw32 -lSDL -mwindows

I think you need to have -lmingw32 on the link line before the SDL library.
You might need -mwindows as well, though that varies between mingw32 releases.

-Sam Lantinga				(slouken at devolution.com)

Lead Programmer, Loki Entertainment Software–
Author of Simple DirectMedia Layer -
http://www.devolution.com/~slouken/SDL/

“Jens” wrote:

Hallihall?f

I’ve done a school work, using SDL. The problem is that the lame
Computer teacher is scared of Linux and refuses to come within 10
meters of a Linux computer. So he demands that I compile it for
win95/NT.

I’ve downloaded, and installed. Mingw32, SDL and DirectX 5 SDK.
When trying to compile it looks like this:

C:\MINGW32\mingw32\bin>gcc -g -Wall -D_REENTRANT -O3 -
I\c:\mingw32\mingw32\inclu
de -o /spec3/Tower /spec3/NY3.c -L\c:\mingw32\mingw32\lib -lSDL
C:\MINGW32\MINGW32\BIN…\lib\gcc-lib\i386-mingw32\egcs-
2.91.60…\i386
-mingw32\lib\libmingw32.a(main.o)(.text+0x7b): undefined reference
to `WinMain at 1
6’

What am I doing wrong?

Hadriel

I hope you’re using a makefile, and I hope you stole it from
the examples, cuz that’s the easiest way to set this up.
You not including Mingw32s windows libs, if you’re using
the makefile use “make target=win32” instead of just "make"
If not get one of the makefiles and pick it apart until you can
figure out what all is being added to the linking gcc call (it’s
the last one it does)

-Phoenix Kokido______________________________________________________
Get your free web-based email at http://www.xoom.com
Birthday? Anniversary? Send FREE animated greeting
cards for any occassion at http://greetings.xoom.com

Sam Lantinga wrote:

I’ve downloaded, and installed. Mingw32, SDL and DirectX 5 SDK.
When trying to compile it looks like this:

C:\MINGW32\mingw32\bin>gcc -g -Wall -D_REENTRANT -O3 -
I\c:\mingw32\mingw32\inclu
de -o /spec3/Tower /spec3/NY3.c -L\c:\mingw32\mingw32\lib -lSDL
C:\MINGW32\MINGW32\BIN…\lib\gcc-lib\i386-mingw32\egcs-
2.91.60…\i386
-mingw32\lib\libmingw32.a(main.o)(.text+0x7b): undefined reference
to `WinMain at 1
6’

What am I doing wrong?

This is my cross-compiler link line:
/usr/win32/bin/gcc -o fire.exe fire.o -L…/…/SDL/lib -lmingw32 -lSDL -mwindows

and possible

  • add -lstc++ at the end of the command, if you want to link c++ code.
  • add -ladvapi32 in front of -lmingw32, when calling things like
    registry access
  • add -lwsock32 in front of -lmingw32, when building things like netlib.> I think you need to have -lmingw32 on the link line before the SDL library.

You might need -mwindows as well, though that varies between mingw32 releases.


Karsten-O. Laux
klaux at student.uni-kl.de
http://www.rhrk.uni-kl.de/~klaux
UIN 21614933 (Bert)

Oki, It works now, Thanx alot =)

Hadriel