wparam does not name a type

This is a discussion on wparam does not name a type within the Windows Programming forums, part of the Platform Specific Boards category; which lib do i have to include to use WPARAM? don't i only need windows.h?...

  1. #1
    Registered User
    Join Date
    Dec 2005
    Location
    Canada
    Posts
    267

    wparam does not name a type

    which lib do i have to include to use WPARAM?

    don't i only need windows.h?

  2. #2
    carry on JaWiB's Avatar
    Join Date
    Feb 2003
    Location
    Seattle, WA
    Posts
    1,972
    Yes, windows.h should cover it (it's defined in windef.h--although you probably shouldn't explicitly include that file)

    If you're having trouble with something, post the section of code that is causing a problem.
    "Think not but that I know these things; or think
    I know them not: not therefore am I short
    Of knowing what I ought."
    -John Milton, Paradise Regained (1671)

    "Work hard and it might happen."
    -XSquared

  3. #3
    Registered User
    Join Date
    Dec 2005
    Location
    Canada
    Posts
    267
    Code:
    #ifndef MAIN_H_INCLUDED
    #define MAIN_H_INCLUDED
    
    #include <windows.h>
    #include "resource.h"
    #include "init.h"
    #include "bitmap.h"
    
    WPARAM MainLoop();
    
    extern HWND g_hWnd;
    extern HINSTANCE g_hInstance;
    
    _buffer g_buffer;
    HWND g_hWnd;
    HINSTANCE g_hInstance;
    
    #endif

  4. #4
    Registered User
    Join Date
    Dec 2005
    Location
    Canada
    Posts
    267
    10 K:\game\source\main.h `WPARAM' does not name a type

  5. #5
    carry on JaWiB's Avatar
    Join Date
    Feb 2003
    Location
    Seattle, WA
    Posts
    1,972
    I don't see anything in that code that would cause your compile error (it's strange that you define your extern variables in the same file that they are declared, though)

    Perhaps the error lies in one of your header files?
    "Think not but that I know these things; or think
    I know them not: not therefore am I short
    Of knowing what I ought."
    -John Milton, Paradise Regained (1671)

    "Work hard and it might happen."
    -XSquared

  6. #6
    Registered User
    Join Date
    Dec 2005
    Location
    Canada
    Posts
    267
    must be...
    i brought WPARAM MainLoop(); down to the bottom and now it says HWND does not name a type
    i'll see if i can find the mistake myself first, ill post the code when i need more help

    those extern variables were declared somewhere else but i moved it into that file and 4got to remove the externs
    Last edited by h_howee; 09-09-2006 at 07:14 PM.

  7. #7
    Registered User
    Join Date
    Dec 2005
    Location
    Canada
    Posts
    267
    The problem's caused by bitmap.h but i dont dont know where in the file it's from

    Code:
    #ifndef BITMAP_H_INCLUDED
    #define BITMAP_H_INCLUDED
    
    #include <windows.h>
    
    class _buffer
    {
          public:
               HBITMAP LoadABitmap(LPSTR);
               void DisplayBitmap(HBITMAP hbmp, int x, int y, bool f);
               void DisplayBitmap(HBITMAP hbmp, int x, int y, RECT rportion, bool f);
               void ClearScreen(int color);
          private:
               HWND hWnd;
               HDC hdcFront;
               //HDC hdcBack;
               HDC hdcBitmap;
    };
    
    #endif
    Last edited by h_howee; 09-09-2006 at 10:51 PM.

  8. #8
    Cat
    Cat is offline
    Registered User
    Join Date
    May 2003
    Posts
    1,571
    Suppose it could be a problem with _buffer -- unless you're the author of the compiler you should never begin a class, variable, function, or constant with an underscore. In general anything beginning with _ or __ is reserved.
    You ever try a pink golf ball, Wally? Why, the wind shear on a pink ball alone can take the head clean off a 90 pound midget at 300 yards.

  9. #9
    Registered User
    Join Date
    Dec 2005
    Location
    Canada
    Posts
    267
    i changed _buffer to C_buffer but it still gives be the same error

  10. #10
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    If you have multiple files, look to the order of #includes; it may be that there's a conflict or that windows.h is not being #included in a way that you expect.
    CProgramming FAQ
    Caution: this person may be a carrier of the misinformation virus.

  11. #11
    carry on JaWiB's Avatar
    Join Date
    Feb 2003
    Location
    Seattle, WA
    Posts
    1,972
    Quote Originally Posted by Cat
    Suppose it could be a problem with _buffer -- unless you're the author of the compiler you should never begin a class, variable, function, or constant with an underscore. In general anything beginning with _ or __ is reserved.
    I thought it was names beginning with an underscore followed by a capital letter (and maybe two underscores--i dont remember)
    "Think not but that I know these things; or think
    I know them not: not therefore am I short
    Of knowing what I ought."
    -John Milton, Paradise Regained (1671)

    "Work hard and it might happen."
    -XSquared

  12. #12
    Work in Progress..... Jaken Veina's Avatar
    Join Date
    Mar 2005
    Location
    Missouri. Go Imos Pizza!
    Posts
    256
    Could you show us the rest of your files.
    Code:
    void function(void)
     {
      function();
     }

  13. #13
    Registered User
    Join Date
    Dec 2005
    Location
    Canada
    Posts
    267
    resource.h
    Code:
    #define IDB_SHIP1_BMP 101
    
    #define IDM_MENU 1000
    
    #define IDMI_FILE_EXIT 1001
    init.h
    Code:
    #ifndef INIT_H_INCLUDED
    #define INIT_H_INCLUDED
    
    #include <windows.h>
    
    int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int);
    
    LRESULT CALLBACK WinProc(HWND, UINT, LPARAM, WPARAM);
    
    void init(HWND);
    
    void deinit();
    
    HWND CreateMainWindow(HINSTANCE);
    
    #endif

  14. #14
    Work in Progress..... Jaken Veina's Avatar
    Join Date
    Mar 2005
    Location
    Missouri. Go Imos Pizza!
    Posts
    256
    void deinit(void);

    I thought that sounded like a syntax error.
    Code:
    void function(void)
     {
      function();
     }

  15. #15
    Registered User
    Join Date
    May 2006
    Posts
    903
    Your error is in init.h. You have reversed LPARAM and WPARAM. It should read:
    Code:
    LRESULT CALLBACK WinProc(HWND, UINT, WPARAM, LPARAM);

Page 1 of 2 12 LastLast
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Getting an error with OpenGL: collect2: ld returned 1 exit status
    By Lorgon Jortle in forum C++ Programming
    Replies: 6
    Last Post: 05-08-2009, 08:18 PM
  2. Little Array Difficulty
    By G4B3 in forum C Programming
    Replies: 16
    Last Post: 03-19-2008, 12:59 AM
  3. Compiler "Warnings"
    By Jeremy G in forum A Brief History of Cprogramming.com
    Replies: 24
    Last Post: 04-24-2005, 01:09 PM
  4. Errors
    By Rhidian in forum C Programming
    Replies: 10
    Last Post: 04-04-2005, 12:22 PM
  5. gcc problem
    By bjdea1 in forum Linux Programming
    Replies: 13
    Last Post: 04-29-2002, 06:51 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21