Undefined Reference To Winmain Dev C++
I'm trying to break my programming virginity with the simple and basic Hello World program but straight from the outset, computer says no.
A few basic's
> Operating system is Windows 10
> Complier is mingGW
> program is written in notepad and saved as a .cpp file
> typing C++ in DOS returns 'C++: Fatal error: no input files' - so I know the compiler has installed correctly
I've copied the program from a C++ book I purchase so I'm confident it correct. However, when I go to DOS and type in C++ hello.cpp the below error appears.
I tried to do a bit of digging around and thought it was a linker problem that's common with windows 10 where windows looks for Winmain to start a program rather than Main. So with this in mind, from DOS, I tried c++ -mwindows -o hello.exe hello.cpp (as -mwindows is supposed to include the extra steps). But this did not work and the same error was received.
I also thought it may be a problem with the compiler so I installed Dev C++ IDE and tried it on there but I got roughly the same error.
minGW Error:
c:/mingw/bin/./lib/gcc/mingw32/5.3.0/././.libmingw32.a(main.o):(.text.startup+0xa0): Undefined reference to 'WinMain@16'
Collect2.exe: error: 1d returned 1 exit status.
Dev C++ error:
- C++ Compiler: C:UsersPublicDev-CppMinGW64bing++.exe
- Command: g++.exe 'C:Usersgreg_MyProgramsHello.cpp' -o 'C:Usersgreg_MyProgramsHello.exe' -I'C:UsersPublicDev-CppMinGW64include' -I'C:UsersPublicDev-CppMinGW64x86_64-w64-mingw32include' -I'C:UsersPublicDev-CppMinGW64libgccx86_64-w64-mingw324.9.2include' -I'C:UsersPublicDev-CppMinGW64libgccx86_64-w64-mingw324.9.2includec++' -L'C:UsersPublicDev-CppMinGW64lib' -L'C:UsersPublicDev-CppMinGW64x86_64-w64-mingw32lib' -static-libgcc
C:UsersPublicDev-CppMinGW64x86_64-w64-mingw32lib/libmingw32.a(lib64_libmingw32_a-crt0_c.o): In function `main':
C:/crossdev/src/mingw-w64-v3-git/mingw-w64-crt/crt/crt0_c.c:18: undefined reference to `WinMain'
collect2.exe: error: ld returned 1 exit status
Program:
#include <iostream>
using namespace std;
//A C++ Program to output a greeting
int Main()
{
cout<<'Hello World!'<<endl;
return 0;
}
Is anyone able to advise please?
Thank you
- There was a Linux version, but it has been abandoned, mainly because Dev-C is written in Delphi, but the Linux version of Delphi (Kylix) wasn't as promising as it should have been. But there are excellent alternative IDEs for Linux, such as KDevelop and Anjuta.
- Nov 05, 2017 For the Love of Physics - Walter Lewin - May 16, 2011 - Duration: 1:01:26. Lectures by Walter Lewin. They will make you ♥ Physics. Recommended for you.
C++ Undefined Reference To Function
Sep 11, 2005 Troughton: I did mean to insult you. Since you say you read the FAQ's, and hopefully you read the one I pointed you to, and based on your response, I will now make the assumption that you simply don't understand what the answer means. Antares harmony vst plugin download windows 7. Active oldest votes. You do indeed lack a WinMain function anywhere in that code. If memory serves me well, WinMain is the entry point for a Win32 GUI app. I am assuming your IDE asked you for a 'project type' of some sort, and you asked for a Windows app instead of a Console one. Apr 30, 2017 You need to add a reference to the SDL library. Also you have created a Windows application instead of a console app. One way to fix this is to change your main to.