Using MS Visual C/C++ command line compiler w/ SDL

Started by
3 comments, last by Bijo 16 years, 11 months ago
I don't have time to look so long on the net and finding all these vague or unclear answers (been doing it for an hour or more). I'll put it down for you easy: I've downloaded Visual C++ only for the compiler which I use with my command prompt... not at all do I use the package for the IDE. Now, my problem is that typical one with the linker that I've seen a lot when searching for answers on the net: LNK1561 fatal error; entry point must be defined. I've set up things correctly as far as I know (copied DLL to system32 directory, etc., etc.), so I'll cut to the chase (but if you need more info, just ask and I'll give it to ya... here's what I do in the raw sense: cl -Ic:\sdl\include mymain.cpp cl: the compiler .exe -I: to specify the include path of SDL mymain.cpp: source file
Advertisement
It looks like you're not linking with the sdl libs...the command line should be something along the lines of:

cl -I"path\to\sdl\include" mymain.cpp /link /libpath:"path\to\sdl\lib" sdl.lib sdlmain.lib

I'm not sure if that command is exactly right, but it should be close.

Edit: You might also need /SUBSYSTEM:WINDOWS after /link, not sure.
---"While there is a lower class I am in it; while there is a criminal element I am of it; while there is a soul in prison, I am not free" - Eugene V. Debs---
Thanks for the reply. I'd actually tried that one out too, but it doesn't work either. Been hammering the thing too long, possible good-looking variations, so I switched back to MinGW/g++, but I get even more errors there, hah hah :)

Thanks still. I'll give it a shot later.
Why are you using the command line compiler? The Microsoft Visual C++ Express Edition is free as well.

C++: A Dialog | C++0x Features: Part1 (lambdas, auto, static_assert) , Part 2 (rvalue references) , Part 3 (decltype) | Write Games | Fix Your Timestep!

Meh, there's something about IDEs I don't like, I don't know what it is. I just detest them, but maybe I should just forget about it and start using one. A simple text editor and a command-line compiler just feel a lot better.

This topic is closed to new replies.

Advertisement