Sublime Forum

No Winmain, Id returned 1 exit status

#1

So… I tried setting the Sublime text with the video from 2020 Link to that video, And I tried copying it myself as a first step for game making.

…And I got stuck.

{
    "folders":
    [
    	{
			"path": "bin/..",
    		"file_exclude_patterns": ["*.sublime-project"]
    	}
    ],

    "build_systems":
    [
	    {
	    	"name": "Build Debug",
		    "working_dir": "${project_path}",
		    "cmd" : "g++ -c src/*.cpp -std=c++14 -g -Wall -m64 -I include -I C:/SDL2-w64/include && g++ *.o -o bin/debug/main -L C:/SDL2-w64/lib -lmingw32 -lSDL2main -lSDL2 -lSDL2_image && start bin/debug/main",
		    "selector": "source.c++",
		    "shell": true
	    },
    ]
}

Project File looks like this

#include "C:/SDL2-w64/include/SDL2/SDL.h"
#include "C:/SDL2-w64/include/SDL2/SDL_image.h"
#include <iostream>

int main(int argc, char* args[])
{
	return 0;
} 

And I programmed it like this.

C:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib/../lib/libmingw32.a(lib64_libmingw32_a-crt0_c.o):crt0_c.c:(.text.startup+0x2e): undefined reference to `WinMain'
collect2.exe: error: ld returned 1 exit status
[Finished in 2.7s]

And I’ve got this.

Since I couldn’t solve it myself I just decided to post this problem. What is wrong with my code and how can I solve it?

0 Likes

#2

See https://wiki.libsdl.org/FAQWindows#i_get_undefined_reference_to_winmain16

0 Likes