Hi everyone!
So I have a new problem. I trying, once again, to set up SDL for c++ in sublime text 2. I’m following the tutorial for set up from his website.
http://lazyfoo.net/SDL_tutorials/lesson01/windows/mingw/index.php
which means that I’m trying to use SDL 1.2.
I have followed the steps exactly, and am trying to run this sample program that the site provides:
#include "SDL/SDL.h"
int main( int argc, char* args[] )
{
//Start SDL
SDL_Init( SDL_INIT_EVERYTHING );
//Quit SDL
SDL_Quit();
return 0;
}
However, I am not sure how to make the build file. I have tried appending
-lmingw32 -lSDLmain -lSDL
to my build file so it looks like this, (the original build file can be found at the bottom):
{
"cmd": ["g++", "$file", "-o", "$file_base_name","-lmingw32", "-lSDLmain", "-lSDL"],
"selector": "source.c++",
"working_dir": "$file_path",
"variants":
[
{
"name": "Run",
"cmd": ["g++", "$file", "-o", "$file_base_name", "&&", "$file_path/$file_base_name","-lmingw32", "-lSDLmain", "-lSDL"],
"shell": true
}
]
}
But it returns the following error, which is the same error that I get if I don’t try to modify my build file:
C:\Users\KEVINZ~1\AppData\Local\Temp\ccasICAw.o:Graphics.cpp:(.text+0xe): undefined reference to `SDL_Init'
C:\Users\KEVINZ~1\AppData\Local\Temp\ccasICAw.o:Graphics.cpp:(.text+0x13): undefined reference to `SDL_Quit'
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../libmingw32.a(main.o):(.text.startup+0xa7): undefined reference to `WinMain@16'
collect2.exe: error: ld returned 1 exit status
[Finished in 0.9s with exit code 1]
Can anyone help me with this problem? Again, I do not have very much experience with computers, so please try to painstakingly spell out any steps that I need to do.
Thank you so much for your time!
(And just in case, here is my unmodified, non-SDL build file that I had originally)
{
"cmd": ["g++", "$file", "-o", "$file_base_name"],
"selector": "source.c++",
"working_dir": "$file_path",
"variants":
[
{
"name": "Run",
"cmd": ["g++", "$file", "-o", "$file_base_name", "&&", "$file_path/$file_base_name"],
"shell": true
}
]
}