This question has been asked by many netizens on the internet, who have given various answers. Here, I also encountered this problem in the SDL multi-media library. After a while of exploration, I finally found the answer.
Under normal circumstances, after compiling the SDL header file and library, you only need to direct the header file and library file path to the correct location. Then, you can directly use the header file and library.
Generally, the static libraries used are SDL. lib and sdlmain. Lib, the dynamic library is SDL. dll, And the header file is SDL. h.
If you use the following in a project:
# Include <SDL. h>
# Pragma comment (Lib, "SDL. lib ")
Int main ()
{
...
}
The above Link error will occur. The reason is that the library sdlmain. Lib is missing. That is, the following solution is used, which is correct.
# Include <SDL. h>
# Pragma comment (Lib, "SDL. lib ")
# Pragma comment (Lib, "sdlmain. lib ")
Int main ()
{
...
}