Talk:SDL:Tutorials:Setup
I'm not sure how to word this into the current instructions, but gcc/g++ (at least under Linux), SDL's compile flags can be determined using sdl-config --cflags and linker flags can be determined using sdl-config --libs. So, to compile and link you can use g++ *.cpp -o game `sdl-config --cflags --libs` - sik0fewl 15:30, 10 Nov 2004 (EST)
That's true, but I don't think it works under Windows, which is why I didn't include it. If you'd like to add an "Under Linux, you can do it this way..." that would be fine by me! Ryan Clark 17:17, 10 Nov 2004 (EST)
The doc says you should change #include "SDL.h" to "SDL/SDL.h". That's wrong, you must leave "SDL.h" if you want your program to be portable and instead leave configure determine the correct include path.
- Good catch. It seems most people don't read that part of the SDL documentation and incorrectly use <SDL/SDL.h> or "SDL/SDL.h" instead of "SDL.h". I changed the the article to state that people should add the SDL include directory to their path. If someone could give step-by-step instructions for adding to the include path for Xcode and KDevelop, that would be nice. - sik0fewl (already typed out my post and not logged in :)
The link to the Dev C++ devpak is porn.
The cmake tutorial seems to be obsolete. Here is a config for CMakeLists.txt that works with KDevelop in Ubuntu 11.10:
project(kdev-test)
set (
SOURCES
main.cpp
)
set (TARGET kdev-test)
find_package(SDL REQUIRED)
find_package(SDL_image REQUIRED)
include_directories(
${SDL_INCLUDE_DIR}
${SDLIMAGE_INCLUDE_DIR}
)
add_executable(
${TARGET} WIN32 MACOSX_BUNDLE
${SOURCES}
)
target_link_libraries(
${TARGET}
${SDLMAIN_LIBRARY}
${SDL_LIBRARY}
${SDLIMAGE_LIBRARY}
)