switch quantity not integer?

This is a discussion on switch quantity not integer? within the C Programming forums, part of the General Programming Boards category; I am trying to make a Windows app, but I have a problem. When I try to compile it, it ...

  1. #1
    Registered User
    Join Date
    May 2007
    Posts
    2

    switch quantity not integer?

    I am trying to make a Windows app, but I have a problem. When I try to compile it, it gives me error "switch quantity not integer". I have defined it, but still it doesn't work. I'm making it with Dev-C++. Here's source code of function with problem:
    Code:
    LRESULT CALLBACK ViestinKasittelija( HWND hWnd, 
                                        UINT Viesti, 
                                        WPARAM wParam, 
                                        LPARAM lParam)
    {
         switch(viesti) {
                 case WM_DESTROY:
                       {
                                  PostQuitMessage( 0 );
                                  return TRUE;
                                  break;
                                  }
                       }
         return DefWindowProc( hWnd, Viesti, wParam, lParam );
    
    }
    If someone needs to see whole source I can put it here.

    I posted this here, because I think this has nothing to do with making Windows-apps. But if someone thinks this belongs to Windows-forum, move this.

  2. #2
    Gawking at stupidity
    Join Date
    Jul 2004
    Location
    Oregon, USA
    Posts
    3,159
    C is case-sensitive. You have "Viesti" in your parameter list, but you're using "viesti" in your switch statement.
    If you understand what you're doing, you're not learning anything.

  3. #3
    Registered User
    Join Date
    May 2007
    Posts
    2
    Damn, I hate these typos. Thanks for help!

    EDIT: Now when I try to compile that app, I'll get error:
    Code:
    [Linked error] undefined reference to 'ViestinKasittelija' @16
    [Linked error] undefinedreference to 'GetStockObject' @4
    [Linked error] undefined reference to 'LuoIkkuna'
    Id returned 1 exit status
    I'll post whole source here via pastebin. -> http://pastebin.ca/505001
    Last edited by Front/slash; 05-23-2007 at 06:00 AM.

  4. #4
    Lean Mean Coding Machine KONI's Avatar
    Join Date
    Mar 2007
    Location
    Luxembourg, Europe
    Posts
    444
    You need to prototype or declare the functions in the code prior to using them.

  5. #5
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    Posts
    3,211
    Quote Originally Posted by KONI View Post
    You need to prototype or declare the functions in the code prior to using them.
    They are prototyped.

    @ Front/slash:

    Your indentation and usage of braces is horrible. That's one of your problems. First of all, it's hard to read. Second of all, the compiler is interpreting everything wrong because of it and the linker can't find the functions properly in your code.

    Fix the braces and you'll lose two of those errors. Link with Gdi32.lib and you'll lose the final one.

  6. #6
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    3,459
    Quote Originally Posted by KONI View Post
    You need to prototype or declare the functions in the code prior to using them.
    He did.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. question in rounding integer in c
    By DrGreat in forum C Programming
    Replies: 5
    Last Post: 04-13-2008, 08:13 AM
  2. switch - continue
    By DavidP in forum C Programming
    Replies: 2
    Last Post: 06-24-2004, 10:09 AM
  3. Please help debug
    By Wexy in forum C Programming
    Replies: 2
    Last Post: 11-10-2002, 11:40 PM
  4. help with switch statements
    By Wexy in forum C Programming
    Replies: 3
    Last Post: 11-06-2002, 04:44 PM

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