Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 10 of 10

Thread: Problem with C++

  1. #1
    Junior Member Newbie
    Join Date
    Nov 2001
    Posts
    3

    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 :-)
    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
    -----------------------------

  2. #2
    Junior Member Regular Contributor
    Join Date
    Jan 2001
    Posts
    181

    Re: Problem with C++

    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.

  3. #3
    Junior Member Newbie
    Join Date
    Nov 2001
    Posts
    3

    Re: Problem with C++

    Thank you very much but it doesn't change anything...same problem :-(

  4. #4
    Senior Member OpenGL Pro
    Join Date
    Jul 2001
    Location
    France
    Posts
    1,749

    Re: Problem with C++

    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

  5. #5
    Junior Member Newbie
    Join Date
    Nov 2001
    Posts
    3

    Re: Problem with C++

    //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?

  6. #6
    Member Regular Contributor nickels's Avatar
    Join Date
    Feb 2000
    Location
    Colorado
    Posts
    298

    Re: Problem with C++

    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.

  7. #7
    Intern Contributor
    Join Date
    Oct 2001
    Posts
    69

    Re: Problem with C++

    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:
    Code :
    int main()
    {
       // stuff
       return 0;
    }
    Declare this:
    Code :
    int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int iCmdShow)
    {
       // stuff
       return 0;
    }
    I'd still bet this is your problem.

    -- sec

  8. #8
    Intern Contributor
    Join Date
    Jan 2002
    Posts
    52

    Re: Problem with C++

    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.

  9. #9
    Junior Member Regular Contributor
    Join Date
    Sep 2001
    Location
    Eastern USA
    Posts
    220

    Re: Problem with C++

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

    Not true at all!

  10. #10
    Junior Member Newbie
    Join Date
    Oct 2001
    Location
    germany
    Posts
    4

    Re: Problem with C++

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •