Herzlich Willkommen, lieber Gast!
  Sie befinden sich hier:

  Forum » C / C++ (WinAPI, Konsole) » was bedeutet dieser fehler?

Forum | Hilfe | Team | Links | Impressum | > Suche < | Mitglieder | Registrieren | Einloggen
  Quicklinks: MSDN-Online || STL || clib Reference Grundlagen || Literatur || E-Books || Zubehör || > F.A.Q. < || Downloads   

Autor Thread - Seiten: [ 1 ] > 2 <
010
15.06.2003, 11:55 Uhr
~Adler
Gast


jo jetzt kommt der fehler:

quellcode1.obj : error LNK2001: unresolved external symbol "long __stdcall WndProc(struct HWND__ *,unsigned int,unsigned int,long)" (?WndProc@@YGJPAUHWND__@@IIJ@Z)
LIBCD.lib(wincrt0.obj) : error LNK2001: unresolved external symbol _WinMain@16
Debug/test1.exe : fatal error LNK1120: 2 unresolved externals
 
Profil || Private Message || Suche Download || Zitatantwort || Editieren || Löschen || IP
011
15.06.2003, 12:33 Uhr
Alois



Das heißt, dass er die Funktionen WndProc und WinMain nicht findet. Wo hast du die denn definiert?
 
Profil || Private Message || Suche Download || Zitatantwort || Editieren || Löschen || IP
012
15.06.2003, 12:40 Uhr
~Adler
Gast


ich habe das im tutorial gemacht, das ist ein tut wo er mir erklärt was ich da mache und dann gibt er mir den code, meinst du der rafft das selbst net?
ich bin auch noch nicht ganz fertig aber er schrieb jetzt kann ich es mal testen:

C++:
#include <windows.h>
#include <gl\gl.h>
#include <gl\glu.h>
#include <gl\glaux.h>


//---------variablen---------------------------------------------------------------------------------

HDC        hDC=NULL;
HWND        hWnd=NULL;
HGLRC        hRC=NULL;

bool        keys[256];                // Array Used For The Keyboard Routine
bool        active=TRUE;                // Window Active Flag Set To TRUE By Default
bool        fullscreen=TRUE;        // Fullscreen Flag Set To Fullscreen Mode By Default

//----------deklaration-----------------------------------------------------------------------------

LRESULT        CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);        // Declaration For WndProc

//----------bei fensteränderung---------------------------------------------------------------------

GLvoid ReSizeGLScene(GLsizei width, GLsizei height)        // Resize And Initialize The GL Window
{
        if (height==0)                                        // Prevent A Divide By Zero By
        {
                height=1;                                // Making Height Equal One
        }

        glViewport(0, 0, width, height);                // Reset The Current Viewport

        glMatrixMode(GL_PROJECTION);                        // Select The Projection Matrix
        glLoadIdentity();                                // Reset The Projection Matrix

        // Calculate The Aspect Ratio Of The Window
        gluPerspective(45.0f,(GLfloat)width/(GLfloat)height,0.1f,100.0f);

        glMatrixMode(GL_MODELVIEW);                     // Select The Modelview Matrix
        glLoadIdentity();                               // Reset The Modelview Matrix
}


int InitGL(GLvoid)                                      // All Setup For OpenGL Goes Here
{

        glShadeModel(GL_SMOOTH);                        // Enables Smooth Shading
        glClearColor(0.0f, 0.0f, 0.0f, 0.0f);                // Black Background

        glClearDepth(1.0);                              // Depth Buffer Setup
        glEnable(GL_DEPTH_TEST);                        // Enables Depth Testing
        glDepthFunc(GL_LEQUAL);                               // The Type Of Depth Test To Do
        glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);    // Really Nice Perspective Calculations
        return TRUE;                                          // Initialization Went OK
}

int DrawGLScene(GLvoid)                                       // Here's Where We Do All The Drawing
{
        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);   // Clear The Screen And The Depth Buffer
        glLoadIdentity();                                 // Reset The Current Modelview Matrix
//-------------------------------------------------------------------------------



//-------------------------------------------------------------------------------
        return TRUE;                                     // Everything Went OK
//-------------------------------------------------------------------------------
}

GLvoid KillGLWindow(GLvoid)                              // Properly Kill The Window
{

    if (fullscreen)                                      // Are We In Fullscreen Mode?
    {
        ChangeDisplaySettings(NULL,0);                   // If So Switch Back To The Desktop
        ShowCursor(TRUE);                                // Show Mouse Pointer
    }
    if (hRC)                                             // Do We Have A Rendering Context?
    {

        if (!wglMakeCurrent(NULL,NULL))                      // Are We Able To Release The DC And RC Contexts?
        {
        MessageBox(NULL,"verbindung zwischen DC und RC konnte nicht getrennt werden.","SHUTDOWN ERROR",MB_OK | MB_ICONINFORMATION);
        }
        if (!wglDeleteContext(hRC))                        // Are We Able To Delete The RC?
        {
        MessageBox(NULL,"Rendering context konnte nicht gelöscht werden.","SHUTDOWN ERROR",MB_OK | MB_ICONINFORMATION);
        }
        hRC=NULL;                                        // Set RC To NULL
    }
    if (hWnd && !DestroyWindow(hWnd))                        // Are We Able To Destroy The Window?
    {
                MessageBox(NULL,"Windows Handle konnte nicht geschossen werden (hWnd).","SHUTDOWN ERROR",MB_OK | MB_ICONINFORMATION);
                hWnd=NULL;                                        // Set hWnd To NULL
    }
}

//---------fenster generieren-------------------------------------------------------

BOOL CreateGLWindow(char* title, int width, int height, int bits, bool fullscreenflag)
{
    GLuint                PixelFormat;                                // Holds The Results After Searching For A Match
    HINSTANCE        hInstance;                                // Holds The Instance Of The Application
    WNDCLASS        wc;                                        // Windows Class Structure

    DWORD                dwExStyle;                                // Window Extended Style
    DWORD                dwStyle;                                // Window Style

    fullscreen=fullscreenflag;                                // Set The Global Fullscreen Flag

    hInstance                = GetModuleHandle(NULL);                // Grab An Instance For Our Window
    wc.style                = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;        // Redraw On Move, And Own DC For Window
    wc.lpfnWndProc                = (WNDPROC) WndProc;                        // WndProc Handles Messages
    wc.cbClsExtra                = 0;                                        // No Extra Window Data
    wc.cbWndExtra                = 0;                                        // No Extra Window Data
    wc.hInstance                = hInstance;                                // Set The Instance
    wc.hIcon                = LoadIcon(NULL, IDI_WINLOGO);                // Load The Default Icon
    wc.hCursor                = LoadCursor(NULL, IDC_ARROW);                // Load The Arrow Pointer
    wc.hbrBackground        = NULL;                                        // No Background Required For GL
    wc.lpszMenuName                = NULL;                                        // We Don't Want A Menu
    wc.lpszClassName        = "OpenGL";                                // Set The Class Name

        if (!RegisterClass(&wc))                                        // Attempt To Register The Window Class
        {
            MessageBox(NULL,"Failed To Register The Window Class.","ERROR",MB_OK|MB_ICONEXCLAMATION);
            return FALSE;                                                // Exit And Return FALSE
        }

        if (fullscreen)                                                        // Attempt Fullscreen Mode?
        {
        DEVMODE dmScreenSettings;                                // Device Mode
        memset(&dmScreenSettings,0,sizeof(dmScreenSettings));        // Makes Sure Memory's Cleared
        dmScreenSettings.dmSize=sizeof(dmScreenSettings);        // Size Of The Devmode Structure
        dmScreenSettings.dmPelsWidth        = width;                // Selected Screen Width
        dmScreenSettings.dmPelsHeight        = height;                // Selected Screen Height
        dmScreenSettings.dmBitsPerPel        = bits;                        // Selected Bits Per Pixel
        dmScreenSettings.dmFields=DM_BITSPERPEL|DM_PELSWIDTH|DM_PELSHEIGHT;
        // Try To Set Selected Mode And Get Results.  NOTE: CDS_FULLSCREEN Gets Rid Of Start Bar.
            if (ChangeDisplaySettings(&dmScreenSettings,CDS_FULLSCREEN)!=DISP_CHANGE_SUCCESSFUL)
            
            {
                // If The Mode Fails, Offer Two Options.  Quit Or Run In A Window.
                if (MessageBox(NULL,"The Requested


Korrektur mike: c++ tags

Dieser Post wurde am 15.06.2003 um 13:56 Uhr von mike editiert.
 
Profil || Private Message || Suche Download || Zitatantwort || Editieren || Löschen || IP
013
15.06.2003, 12:41 Uhr
~Adler
Gast



C++:
"Fullscreen Mode Is Not Supported By\n Your Video Card. Use Windowed Mode Instead?","NeHe GL",MB_YESNO|MB_ICONEXCLAMATION)==IDYES)
                {
                fullscreen=FALSE;                        // Select Windowed Mode (Fullscreen=FALSE)
                }
                else
                {
                // Pop Up A Message Box Letting User Know The Program Is Closing.
                MessageBox(NULL,"Program Will Now Close.","ERROR",MB_OK|MB_ICONSTOP);
                return FALSE;                                // Exit And Return FALSE
                }
            }
        }
            if (fullscreen)                                    // Are We Still In Fullscreen Mode?
            {

            dwExStyle=WS_EX_APPWINDOW;                        // Window Extended Style
            dwStyle=WS_POPUP;                                // Windows Style
            ShowCursor(FALSE);                                // Hide Mouse Pointer
        }
        else
        {
        dwExStyle=WS_EX_APPWINDOW | WS_EX_WINDOWEDGE;        // Window Extended Style
        dwStyle=WS_OVERLAPPEDWINDOW;                        // Windows Style
                                                            // Window Style

        }

        if (!(hWnd=CreateWindowEx(        dwExStyle,                        // Extended Style For The Window
                                        "OpenGL",                        // Class Name
                                        title,                                // Window Title
                                        WS_CLIPSIBLINGS |                // Required Window Style
                                        WS_CLIPCHILDREN |                // Required Window Style
                                        dwStyle,                        // Selected Window Style
                                        0, 0,                                // Window Position
                                        width, height,                        // Selected Width And Height
                                        NULL,                                // No Parent Window
                                        NULL,                                // No Menu
                                        hInstance,                        // Instance
                                        NULL)))                                // Don't Pass Anything To WM_CREATE
        {
        KillGLWindow();                                                // Reset The Display
        MessageBox(NULL,"Window Creation Error.","ERROR",MB_OK|MB_ICONEXCLAMATION);
        return FALSE;                                                // Return FALSE
        }



        static        PIXELFORMATDESCRIPTOR pfd=                                // pfd Tells Windows How We Want Things To Be
        {
        sizeof(PIXELFORMATDESCRIPTOR),                                // Size Of This Pixel Format Descriptor
        1,                                                        // Version Number
        PFD_DRAW_TO_WINDOW |                                        // Format Must Support Window
        PFD_SUPPORT_OPENGL |                                        // Format Must Support OpenGL
        PFD_DOUBLEBUFFER,                                        // Must Support Double Buffering
        PFD_TYPE_RGBA,                                                // Request An RGBA Format
        bits,                                                        // Select Our Color Depth
        0, 0, 0, 0, 0, 0,                                        // Color Bits Ignored
        0,                                                        // No Alpha Buffer
        0,                                                        // Shift Bit Ignored
        0,                                                        // No Accumulation Buffer
        0, 0, 0, 0,                                                // Accumulation Bits Ignored
        16,                                                        // 16Bit Z-Buffer (Depth Buffer)
        0,                                                        // No Stencil Buffer
        0,                                                        // No Auxiliary Buffer
        PFD_MAIN_PLANE,                                                // Main Drawing Layer
        0,                                                        // Reserved
        0, 0, 0                                                        // Layer Masks Ignored
        };



        if (!(hDC=GetDC(hWnd)))                                                // Did We Get A Device Context?
        {
        KillGLWindow();                                                // Reset The Display
        MessageBox(NULL,"Can't Create A GL Device Context.","ERROR",MB_OK|MB_ICONEXCLAMATION);
        return FALSE;                                                // Return FALSE
        }

        if (!(PixelFormat=ChoosePixelFormat(hDC,&pfd)))                        // Did Windows Find A Matching Pixel Format?
        {
        KillGLWindow();                                                // Reset The Display
        MessageBox(NULL,"Can't Find A Suitable PixelFormat.","ERROR",MB_OK|MB_ICONEXCLAMATION);
        return FALSE;                                                // Return FALSE
        }

        if(!SetPixelFormat(hDC,PixelFormat,&pfd))                        // Are We Able To Set The Pixel Format?
        {
        KillGLWindow();                                                // Reset The Display
        MessageBox(NULL,"Can't Set The PixelFormat.","ERROR",MB_OK|MB_ICONEXCLAMATION);
        return FALSE;                                                // Return FALSE
        }

        if (!(hRC=wglCreateContext(hDC)))                                // Are We Able To Get A Rendering Context?
        {
        KillGLWindow();                                                // Reset The Display
        MessageBox(NULL,"Can't Create A GL Rendering Context.","ERROR",MB_OK|MB_ICONEXCLAMATION);
        return FALSE;                                                // Return FALSE
        }


        if(!wglMakeCurrent(hDC,hRC))                                        // Try To Activate The Rendering Context
        {
                KillGLWindow();                                                // Reset The Display
                MessageBox(NULL,"Can't Activate The GL Rendering Context.","ERROR",MB_OK|MB_ICONEXCLAMATION);
                return FALSE;                                                // Return FALSE
        }


        ShowWindow(hWnd,SW_SHOW);                                        // Show The Window
        SetForegroundWindow(hWnd);                                        // Slightly Higher Priority
        SetFocus(hWnd);                                                        // Sets Keyboard Focus To The Window
        ReSizeGLScene(width, height);                                        // Set Up Our Perspective GL Screen

        if (!InitGL())                                                        // Initialize Our Newly Created GL Window
        {
        KillGLWindow();                                                // Reset The Display
        MessageBox(NULL,"Initialization Failed.","ERROR",MB_OK|MB_ICONEXCLAMATION);
        return FALSE;                                                // Return FALSE
        }

        return TRUE;                                                        // Success
}


ja das ist das soweit
Korrektur mike: c++ tags

Dieser Post wurde am 15.06.2003 um 13:57 Uhr von mike editiert.
 
Profil || Private Message || Suche Download || Zitatantwort || Editieren || Löschen || IP
014
15.06.2003, 13:07 Uhr
Alois



Wenn du ein Programm für Windows schreibst, dann brauchst du unbedingt die FunktionWinMain, und für jedes Fenster eine Fensterprozedur, die du hier als WndProc deklariert hast. Schreib also erst mal den ganzen Code ab, wenn du willst, dass das Programm kompiliert wird.
Ich hab dieses Tutorial auch schon mal verwendet und, soweit ich mich erinnere, steht da auch was über die Grundlagen vom Erstellen von Fenstern usw. Lies dir das erstmal durch, bevor du mit OpenGL anfängst, dann verstehst du auch, was der will.
 
Profil || Private Message || Suche Download || Zitatantwort || Editieren || Löschen || IP
015
15.06.2003, 13:16 Uhr
Adler



ja das ist das erste, das sind die grundlagen zum fenster erstellen.
oah mein gott da brauch ich noch länger zum durchblicken


--

Zitat:
www.mapping-tut.de.vu (aufbauphase)
 
Profil || Private Message || Suche Download || Zitatantwort || Editieren || Löschen || IP
Seiten: [ 1 ] > 2 <     [ C / C++ (WinAPI, Konsole) ]  


ThWBoard 2.73 FloSoft-Edition
© by Paul Baecher & Felix Gonschorek (www.thwboard.de)

Anpassungen des Forums
© by Flo-Soft (www.flo-soft.de)

Sie sind Besucher: