Problem with C++

Hi,
I hope it’s not the wrong forum for my question…if so, then please forgive me.

The point: I use Visual C++ Enterprise and I want to draw a circle with openGl.

I can compile my circle.c but the linker is not quite amused about it and throws the (german only) exception:

--------------------Konfiguration: U1 - Win32 Debug--------------------
Linker-Vorgang läuft…
libcd.lib(wwincrt0.obj) : error LNK2001: Nichtaufgeloestes externes Symbol _wWinMain@16
Debug/U1.exe : fatal error LNK1120: 1 unaufgeloeste externe Verweise
Fehler beim Ausführen von link.exe.

U1.exe - 2 Fehler, 0 Warnung(en)

What should I do?

thanks.

P.S. It’s my first C++ program, so don’t flame :slight_smile:
P.P.S
Here are the project properties:

libcd.lib /nologo /entry:“wWinMainCRTStartup” /subsystem:windows /incremental:yes /pdb:“Debug/U1.pdb” /debug /machine:I386 /nodefaultlib:“libcmtd.lib” /nodefaultlib:“libcmt.lib” /nodefaultlib:“msvcrt.lib” /nodefaultlib:“msvcrtd.lib” /out:“Debug/U1.exe” /pdbtype:sept

when writing windows programs you need to define a winmain procedure instead of the main procedure like usual.
the concret params and so on you can read in the MSDE (language documentation) about it.

Thank you very much but it doesn’t change anything…same problem :frowning:

I will have some advises:

  1. C++ is not a basic language, so learn it as much well as you can.

  2. OpenGL must be learnt, so learn it before trying making anything with it.

  3. OpenGL is wrote with C, not C++.

Now, if you want to make a circle, i need to know some:
are you using glut ? wgl ? windows with opengl ?
if it’s glut, you must link your program with glut32.lib, glu32.lib and opengl32.lib
otherwise, it won’t work

//I will have some advises:
//1. C++ is not a basic language, so learn it as much well as you can.

  1. Ok, I’m about to learn it.

  2. OpenGL must be learnt, so learn it before trying making anything with it.

  3. I’m trying to make my college exercises and the first question was: compile and link the file circle.c
    The file is OK, I just must compile it.

//3. OpenGL is wrote with C, not C++.

//Now, if you want to make a circle, i need to know some:
//are you using glut ? wgl ? windows with opengl ?
//if it’s glut, you must link your program with glut32.lib, glu32.lib and opengl32.lib
otherwise, it won’t work

  1. The circle-file exists and I linked with glut, so no problems with it.

thanks a lot.

Ray

P.S. Any concret ideas?

What windowing library is the program using? Is is aux or glut?

You may just need to tell the compiler you want to build a console app instead of a windowed app. Then it will look for main, not WinMain.

DN.
Microsoft is evil, even in German.

I know it was mentioned before, but are you ABSOLUTELY sure you declared a WinMain function instead of the non-Windows main function? In other words, instead of having something like this:

int main()
{
// stuff
return 0;
}

Declare this:

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int iCmdShow)
{
// stuff
return 0;
}

I’d still bet this is your problem.

– sec

I’d agree with sebnuoc. Is the project type a Win32 console application or a Win32 application? In the case of the former a winmain(…) function isnt used, but int main(…) is.

I am still learning OpenGL and use console applications for all my OpenGL programs. They are far simpler and I would recommend this approach if you are new to C++ as well.

“3. OpenGL is wrote with C, not C++.”

Not true at all!

Sounds like you created a Win32 Project while trying to write a console application. Try to recreate the project as a console application project.

W.