PDA

View Full Version : Problem with C++



Raysoft
11-02-2001, 03:26 AM
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 :-)
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
-----------------------------

jabe
11-02-2001, 03:41 AM
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.

Raysoft
11-02-2001, 03:52 AM
Thank you very much but it doesn't change anything...same problem :-(

jide
11-02-2001, 04:06 AM
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

Raysoft
11-02-2001, 04:19 AM
//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.

2. 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

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

thanks a lot.

Ray

P.S. Any concret ideas?

nickels
11-02-2001, 07:23 AM
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.

secnuop
11-02-2001, 11:11 AM
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

endo
11-03-2001, 05:01 AM
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.

Omaha
11-04-2001, 05:54 AM
"3. OpenGL is wrote with C, not C++."

Not true at all!

W
11-05-2001, 12:55 AM
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.