Jump to content

how do i fix "undefined reference to `WinMain' collect2.exe: error: ld returned 1 exit status"

Guest
#include <stdio.h>

int main(){
    printf("Hello world");
    return 0;
}

Its my first time using c language and setting it up. I already include path for mingw on my windows and i install c/c++ and code runner in my visual studio code.
when i run the code i got this error how do i fix this

Link to comment
Share on other sites

Link to post
Share on other sites

The code is correct.

You could try to compile it from command line. See what happens

gcc filename.c -o filename

then run it with

./filename

ಠ_ಠ

Link to comment
Share on other sites

Link to post
Share on other sites

I managed to reproduce the error. Just save the file before using code runner.

ಠ_ಠ

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×