Menu

Missing structs in windows?

JJFMJR
2007-09-04
2012-09-26
  • JJFMJR

    JJFMJR - 2007-09-04

    Hey all, I'm getting this error, which I've never gotten before:

    Compiler: Default compiler
    Building Makefile: "C:\Users\JohnJr\Desktop\My Programs\Labrinth\Level Designer\Other\Makefile.win"
    Executing make...
    c:\dev-cpp\bin\make.exe -f "C:\Users\JohnJr\Desktop\My Programs\Labrinth\Level Designer\Other\Makefile.win" all
    c:\dev-cpp\bin\g++.exe -c Main.cpp -o Main.o -I"C:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include" -I"C:/Dev-Cpp/include/c++/3.4.2/backward" -I"C:/Dev-Cpp/include/c++/3.4.2/mingw32" -I"C:/Dev-Cpp/include/c++/3.4.2" -I"C:/Dev-Cpp/include" -D__GNUWIN32__ -W -DWIN32 -DNDEBUG -D_WINDOWS -D_MBCS

    In file included from LevelClass.h:7,
    from Main.cpp:11:
    CTargaImage.h:99:7: warning: no newline at end of file
    In file included from Main.cpp:13:
    vector.h:236:7: warning: no newline at end of file
    In file included from Main.cpp:14:
    Plane.h:89:22: warning: no newline at end of file
    Main.cpp: In function LRESULT MainWindowProc(HWND__*, UINT, WPARAM, LPARAM)': Main.cpp:400: error:OPENFILENAME' undeclared (first use this function)
    Main.cpp:400: error: (Each undeclared identifier is reported only once for each function it appears in.)
    Main.cpp:400: error: expected ;' before "ofn" Main.cpp:403: error:ofn' undeclared (first use this function)
    Main.cpp:410: error: OFN_EXPLORER' undeclared (first use this function) Main.cpp:410: error:OFN_FILEMUSTEXIST' undeclared (first use this function)

    Main.cpp:410: error: OFN_HIDEREADONLY' undeclared (first use this function) Main.cpp:413: error:GetOpenFileName' undeclared (first use this function)

    Main.cpp: In function int WinMain(HINSTANCE__*, HINSTANCE__*, CHAR*, int)': Main.cpp:550: warning: passing NULL used for non-pointer converting 1 ofHWND__ CreateWindowExA(DWORD, const CHAR, const CHAR, DWORD, int, int, int, int, HWND__, HMENU__, HINSTANCE__, void*)'

    c:\dev-cpp\bin\make.exe: *** [Main.o] Error 1

    Execution terminated

    Saying that those files are undefined, however I have included windows.h. Can anyone explain why. Here's the section of code:

    case ID_Load:
    {
    OPENFILENAME ofn;
    char szFileName[MAX_PATH] = "";

                        ZeroMemory(&ofn, sizeof(ofn));
    
                        ofn.lStructSize = sizeof(ofn);
                        ofn.hwndOwner = hWnd;
                        ofn.lpstrFilter = "Level Files (*.llvl)\0*.llvl";
                        ofn.lpstrFile = szFileName;
                        ofn.nMaxFile = MAX_PATH;
                        ofn.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;
                        ofn.lpstrDefExt = "lvl";
    
                        if(GetOpenFileName(&ofn))
                        {
                            // Do something usefull with the filename stored in szFileName 
                        }
    
                        break;
                    }
    
     
    • JJFMJR

      JJFMJR - 2007-09-07

      Well I've fixed all errors in the Warning message resulting in:

      Compiler: Default compiler
      Building Makefile: "C:\Users\JohnJr\Desktop\My Programs\Labrinth\Level Designer\Other\Makefile.win"
      Executing make...
      c:\dev-cpp\bin\make.exe -f "C:\Users\JohnJr\Desktop\My Programs\Labrinth\Level Designer\Other\Makefile.win" all
      c:\dev-cpp\bin\g++.exe -c Main.cpp -o Main.o -I"C:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include" -I"C:/Dev-Cpp/include/c++/3.4.2/backward" -I"C:/Dev-Cpp/include/c++/3.4.2/mingw32" -I"C:/Dev-Cpp/include/c++/3.4.2" -I"C:/Dev-Cpp/include" -D__GNUWIN32__ -W -DWIN32 -DNDEBUG -D_WINDOWS -D_MBCS

      Main.cpp: In function `LRESULT MainWindowProc(HWND__*, UINT, WPARAM, LPARAM)':

      Main.cpp:394: error: `OPENFILENAME' undeclared (first use this function)

      Main.cpp:394: error: (Each undeclared identifier is reported only once for each function it appears in.)
      Main.cpp:394: error: expected `;' before "ofn"

      Main.cpp:397: error: ofn' undeclared (first use this function) Main.cpp:404: error:OFN_EXPLORER' undeclared (first use this function)
      Main.cpp:404: error: OFN_FILEMUSTEXIST' undeclared (first use this function) Main.cpp:404: error:OFN_HIDEREADONLY' undeclared (first use this function)
      Main.cpp:407: error: `GetOpenFileName' undeclared (first use this function)

      Main.cpp: In function int WinMain(HINSTANCE__*, HINSTANCE__*, CHAR*, int)': Main.cpp:544: warning: passing NULL used for non-pointer converting 1 ofHWND__ CreateWindowExA(DWORD, const CHAR, const CHAR, DWORD, int, int, int, int, HWND__, HMENU__, HINSTANCE__, void*)'

      c:\dev-cpp\bin\make.exe: *** [Main.o] Error 1

      Execution terminated

      Still poses the same error.

       
      • Osito

        Osito - 2007-09-07

        You do still have spaces in your path. Maybe it's not the problem, but it does cause unpredictable behavior sometimes.

         
    • JJFMJR

      JJFMJR - 2007-09-07

      Actually fixed that just after compiling, didn't help :/, but thanks for input.

       
    • Anonymous

      Anonymous - 2007-09-04

      Obviously the compiler does not know what thing is OPENFILENAME, so start in this error and clean the warnings (insert a CR ending the last line).

      Old Newbie

       
    • Wayne Keen

      Wayne Keen - 2007-09-04

      You are also tempting fate by putting your code in a path with spaces in it:

      C:\Users\JohnJr\Desktop\My Programs\Labrinth\Level Designer\Other

      It is not hurting you right now, but it will bite you eventually, and hard.

      Wayne

       
    • Anonymous

      Anonymous - 2007-09-04

      OPENFILENAME is defined in commdlg.h, which is included when you include windows.h. If you have included windows.h then you need to fix the newline warnings. If the last line of CTargaImage.h or vector.h is a comment, the line following the inclusion will become part of the comment and will thus be ignored, which may be what happened to windows.h. Even if it is not a comment the next line in the including source will be concatenated, resulting in some undesirable behaviour.

      You know taht under Tools->Editor options->General, there is an option that will let Dev-C++ and a newline automatically for you.

      Clifford

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.