+ 7
Help! SDL Setup -> Undefined References!
lazyfoo.net/tutorials/SDL/01_hello_SDL/windows/codeblocks/index.php I am currently using this tutorial to set up SDL libraries and headers in CodeBlocks. I completed all the steps for a project, created a new file, and wrote some simple code. Compiling using F9 gives me the following errors: In SDL_main(): ... Undefined reference to SDL_Init(); ... Undefined reference to SDL_CreateWindow(); ... ... Undefined reference to "WinMain@16" Why do I get these? And how can I solve these?
18 ответов
+ 8
this error usually means codeblocks can not find sdl. see step 5
+ 8
oooooooo visual studio seems the go i guess
+ 6
just to clarify, you are using windows right
+ 6
is your main function look like:
int main(int argc, char* args[])
+ 6
😭 must be a way.. i was using it on linux just fine..
did you get the mingw sdl development files?
+ 5
repeating a skipped step is usually enough to resolve the issue. each section that you can mess up has a little blurb on what errors you might get if it was not done correctly. sure it could be more though
+ 5
http://forums.libsdl.org/viewtopic.php?p=49618
this guy describes your exact issue
+ 4
@Kinshuk
You are using SDL as well? Nice!
Are you using SDL1 or SDL2?
+ 4
@Jay is good with SDL2
+ 4
How many codes are tied to that function?
edit
How many dependencies does it have?
where should it have been defined?
+ 4
@jay
I think I have messed up the linker step, as the program is complaining of undefined references.
But why hasn't lazy foo described solutions for the messing up problems?
+ 4
@Manual
Right now, just one code file. Its just a test code.
I usually use SDL 2 on VS, but I wished to use it on CodeBlocks as well...
+ 4
@Jay
I tried repeating the steps again and again, but still can't solve the problem.
It seems the SDL_main() is clashing with the WinMain, and the compiler still believes WinMain to be the application's entry point.
//Perhaps that is the reason I get the last error as:
//undefined reference to WinMain@16 ?
I think Ill have to temporarily disable it, but I don't know how...
+ 4
@jay
Yes, thats how my main looks like this now.
I am trying to use SDL in CodeBlocks on Windows right now...
Sorry for the linux confusion, that was a typo...
+ 4
there are a few thing here u could try:
https://wiki.libsdl.org/FAQWindows
+ 4
Where do I write this: sdf-config --libs??
+ 4
The problem, still exists... 😢
I guess there is no solution then except shifting back to VS...
+ 3
@jay
Yes, I did, But to no avail.