Jump to content
  • Advertisement
Sign in to follow this  
thugkilla

Windows problems

This topic is 4650 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

#include <windows.h> int WINAPI Winmain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpcmdline,int nShowCmd) { MessageBox(NULL,"hi","hay",MB_OK|MB_ICONEXCLAMATION); } Compiler: Default compiler Building Makefile: "C:\Dev-Cpp\Makefile.win" Executing make... make.exe -f "C:\Dev-Cpp\Makefile.win" all g++.exe -c Untitled1.cpp -o Untitled1.o -I"C:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include" -I"C:/Dev-Cpp/include/c++/3.4.2/backward" -I"C:/Dev-Cpp/include/c++/3.4.2/mingw32" -I"C:/Dev-Cpp/include/c++/3.4.2" -I"C:/Dev-Cpp/include" g++.exe Untitled1.o -o "Project1.exe" -L"C:/Dev-Cpp/lib" lib/libmingw32.a lib/libmingw32.a(main.o)(.text+0x106):main.c: undefined reference to `WinMain@16' collect2: ld returned 1 exit status make.exe: *** [Project1.exe] Error 1 Execution terminated

Share this post


Link to post
Share on other sites
Advertisement
Give the function a return of 0. Thats the only thing i can see that is wrong with it.

ace

Share this post


Link to post
Share on other sites
Do you have a function named "WinMain" or "main"? The linker is looking for "WinMain". I assume it works similarly to Visual Studio where you say you want a Windows app and you use WinMain, or you say you want a console app and you use main.

Share this post


Link to post
Share on other sites
Make sure that you have started the right type of project, namely a Win32 project not a Windows Console project. Each has a different 'main' function definition.

ace

EDIT: Completely thrashed, darn

Share this post


Link to post
Share on other sites
C/C++ is case sensitive
It is correct to say it cannot find WinMain; as there is no function with that name defined
rename Winmain to WinMain

Share this post


Link to post
Share on other sites
Compiles and executes just fine here using both Dev-C++ 4.9.9.2 and Visual Studio .NET 2003. The code you have (minus simple typo) is fine. Did you try cleaning and rebuilding? Did you make any configuration changes in your Dev-C++ environment trying to get it to build when you had your linker error? If you generate a new Windows Application Project and immediately compile and run, does it work?

Just some things to think about.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!