File build error . cpp using Mingw

Asked

Viewed 90 times

2

Today I reinstalled Mingw and set it up again, I tried it several times with some programs in c++ and it was working fine, but now I try to create new programs and when I will compile using the command:

g++ -o file file.cpp

He accuses the following mistake:

c:/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../libmingw32.a(main.o):(.text.startup+0xa0): undefined reference to 'WinMain@16'

I managed to solve the problem by changing the main statement of:

int main()

for:

int main(int argc, char* argv[])

And now I can compile the programs normally. However, I would like to know what was the origin of the error, since earlier today I wrote and compiled programs with the main structure of the above example without any problem. Would anyone know to tell me?

  • 2

    What code you tried to compile and failed?

  • You will not have tried to compile before you even save the file ?

1 answer

0

Browser other questions tagged

You are not signed in. Login or sign up in order to post.