Undefined reference to 'SDL_main'

前端 未结 5 791
没有蜡笔的小新
没有蜡笔的小新 2020-12-11 04:59

I\'ve recently decided to try working with SDL with CodeBlocks 10.05. I started with the tutorial on http://www.sdltutorials.com/sdl-tutorial-basics and did my best to follo

5条回答
  •  感动是毒
    2020-12-11 05:26

    Recently, I had this problem, watched some YouTube videos and also followed the installation guide by LazyFoo and I kept getting the "Undefined reference to SDL_main" error.

    I followed everything said here after successfully linking the minGw files to my project properties, but it didn't work until I added to my main function int main (int argv, char** args) and voila, it worked.

    using namespace std;
    
    int main(int argv, char** args) {    if(SDL_Init(SDL_INIT_VIDEO)<0)    {
           cout<<"Endl Init Failed."<

    Why it worked is still not clear to me but it worked anyway.

提交回复
热议问题