Cannot find -lSDLmain and -lSDL when compiling simple SDL program with g++

橙三吉。 提交于 2020-01-30 11:39:48

问题


I installed SDL2 for mingw using this guide. However, when i try to compile using the compilation syntax and test code they provide, only with my own file names, I get the error shown here. I assume that this error has something to do with a problem in the way I installed SDL, as the installation instructions did not exactly match the files with which I was provided, but I did my best to follow them. Could they problem be something else? If not what is the correct way to install SDL2 for mingw?

Note: I do have the SDL2.dll file in the sdltest folder where I try to compile the program.


回答1:


One way to let MinGW know where your SDL libraries are would be to create environment variable named "LIBRARY_PATH" with the value as the path to the directory containing the libraries. Similarly, you can have "CPLUS_INCLUDE_PATH" for the headers as well.

Did you follow step 2 of that tutorial ?



来源:https://stackoverflow.com/questions/28293572/cannot-find-lsdlmain-and-lsdl-when-compiling-simple-sdl-program-with-g

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!