View Full Version : Error
I have just started programming with OpenGL and have gone through this tutorial http://nehe.gamedev.net/tutorials/lesson01.asp to find the basis of a set of OpenGL code.
but in compiling using Dev-C++ i get this error
Building Makefile: "D:\Dev-C++\Basis\Makefile.win"
make.exe all -f "D:\Dev-C++\Basis\Makefile.win"
g++.exe -o "D:\Dev-C++\Basis\Basis.exe" -L"D:\DEV-C++\lib" -I"D:\DEV-C++\include" -I"D:\DEV-C++\include\g++-3" -I"D:\DEV-C++\include" -lopengl32 -lglu32 -lglut32 -fno-access-control -s -mwindows
D:\DEV-C++\lib/libmingw32.a(main.o)(.text+0x8e): undefined reference to `WinMain@16'
04-02-2002, 08:48 AM
Do you have, I think they're called, OPENGL32.DLL, GLU32.DLL, and GLUT.DLL in WINDOWS\SYSTEM directory, or in the directory of your executable file?
04-02-2002, 09:02 AM
your code starts in
but you have created a windows app, so the linker expects a
how do i call that function from main()
is it just winmain();?
or do i need winmain(that stuff thats in here);
and where do i initializes (its been ages since ive done c++ so ive forgotten a fair bit) winmain();
04-03-2002, 04:38 AM
your program should either have a main() or a WinMain() but not both. in MSVC, a Win32 App uses WinMain(), whereas a Win32 Console App uses only main(). the console app should be used when using glut. this gives you a controlling terminal while your program is being run.
04-03-2002, 07:03 PM
If you're just trying to figure out how to build NeHe's Lesson 1, your code should look exactly how it looks in Lesson 1. When doing a Win32 GUI app, WinMain(...) is the main function. You don't need a separate main() to call it from.
Hope this helps.
04-03-2002, 07:17 PM
As stated above, a windows application, be default, begins in WinMain(), not main(). This can be changed in some compilers, but there is no need to change it. Just change the main() function you have in your code now to:
int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR CmdLine, int nShowCmd)
Obviously you don't need to use the same variable names as the code above, but that's the entry point to any Microsoft Windows application.
Hope it helps...
ah ok thx... i was told i needed a console app, but i did not know about the whole main/winmain thing thx
i removed the int WINAPI win and just main is left and i am still getting the same error even though there are no more refrences to winmain
04-04-2002, 05:20 AM
[Edit] Ignore below. I just realised you are using Dev-C++ and not MSVC++.
Assuming you are using MSVC++, when you were creating the code did you create a console app or a win32 app?
[This message has been edited by Furrage (edited 04-04-2002).]
04-04-2002, 10:57 AM
If you're just gonna use main(), then in your project file, you need to declare you're making a console app, and not a Win32 app. Then you won't get this error. Don't know how to do this in Dev-C++ though.
Powered by vBulletin® Version 4.2.3 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.