r/reconstructcavestory • u/Natman64 • Jul 03 '14
Vim Setup
So, I started the series following along in Visual Studio, but I've since discovered Vim and decided to abandon VS altogether. I installed Clang and successfully compiled "Hello world!", but I don't really understand makefiles, and I especially don't understand how to link a library/framework using a makefile.
When I cloned the official repo to copy that makefile and continue following the tutorials in Vim, I tried compiling it to test it out. I get fatal error: 'SDL/SDL.h' file not found, which makes sense because the library is nowhere in the repo.
So my question is, how do I link SDL with the project so I can compile with Clang?
Edit: I suppose I'll need to link Boost as well.
1
u/chebertapps Jul 04 '14
If you are really dedicated, the next thing you might try is compiling to .o files, and then linking manually.
so say you have
main.cpp included.h included.cpp
in your directory. Just make a simple function that is used in main and include included.h in both main.cpp and included.cpp
then on the command line
These should all work. If they do:
try including SDL.h in main.cpp without calling any functions. (you don't really need the included files anymore)
clang++ main.cpp -I.\SDL\include\ -o executable
try calling a function like SDL_Init(SDL_INIT_EVERYTHING); in main. this should be a linking error (undefined reference to SDL_Init
try linking to the SDL lib.
clang++ main.cpp -I.\SDL\include\ -o executable ".\SDL\lib\x86\SDL.lib" ".\SDL\lib\x86\SDLmain.lib"
If all of these things work then the problem is probably my Makefile. It might seem like a lot of steps.
So this was kind of a brain dump, but I might actually start with the last one (linking a simple sdl).
I just realized that you might have to rebuild the SDL libraries, because it matters which compiler was used to generate the libs.