Windows using Dev-C++

This is a discussion on Windows using Dev-C++ within the C++ Programming forums, part of the General Programming Boards category; 14 C:\Dev-Cpp\Untitled1.cpp expected constructor, destructor, or type conversion before '.' token Do anyone have any idea what kind of error ...

  1. #1
    C++ Beginner
    Join Date
    Jun 2005
    Posts
    39

    Windows using Dev-C++

    14 C:\Dev-Cpp\Untitled1.cpp expected constructor, destructor, or type conversion before '.' token

    Do anyone have any idea what kind of error this is? I can't make process with my program because this error always pops up. No one seems to be able to find out what causes this ><.

  2. #2
    Pursuing knowledge confuted's Avatar
    Join Date
    Jun 2002
    Posts
    1,916
    With a description like that, it's no wonder nobody can figure out what your problem is. It's not a result of #include "windows.h", I can tell you that, because it's perfectly possible to develop for windows using Dev C++. Reply to this thread and include the code around line 14 of Untitled1.cpp. You're doing something wrong with a pointer, structure, or class.
    Away.

  3. #3
    C++ Beginner
    Join Date
    Jun 2005
    Posts
    39
    You don't understand, it has nothing to do with the code, for every single line of my code has the same error. This is a common problem as I searched through the web, and it seems as if no one ever can answer this, but if you want to see the code so bad here it is:

    Code:
    #include <windows.h>
    class CApp
    {
    public:
      int Main(HINSTANCE hInstance, LPSTR lpCmdLine, int nCmdShow);
    };
    WNDCLASSEX wcex;
    HWND hWnd; message window
    
    // Register the Windows class:
    
    wcex.cbSize = sizeof(WNDCLASSEX); 
    
    wcex.style         = CS_HREDRAW;
    wcex.lpfnWndProc   = (WNDPROC) GlobalWndProc;
    wcex.cbClsExtra    = 0;
    wcex.cbWndExtra    = 0;
    wcex.hInstance     = hInstance;
    wcex.hIcon         = NULL;
    wcex.hCursor       = LoadCursor(NULL, IDC_ARROW);
    wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
    wcex.lpszMenuName  = NULL;
    wcex.lpszClassName = WINDOW_CLASS;
    wcex.hIconSm       = NULL;
    
    if (!RegisterClassEx(&wcex))
      return 0;
    
    // Create the Window
    hWnd = CreateWindowEx(NULL, WINDOW_CLASS,
        Pokemon RPG, WS_OVERLAPPED, 
        GetSystemMetrics(SM_CXSCREEN) / 2 - 300 / 2,
        GetSystemMetrics(SM_CYSCREEN) / 2 - 200 / 2,
        300, 200, NULL, NULL, hInstance, this);
    
    if(!hWnd) return 0;
    ShowWindow(hWnd, SW_SHOW);
    UpdateWindow(hWnd);
    it is not finished yet.. but it shouldn't be getting these errors
    14 C:\Dev-Cpp\Untitled1.cpp expected constructor, destructor, or type conversion before '.' token
    14 C:\Dev-Cpp\Untitled1.cpp expected `,' or `;' before '.' token
    15 C:\Dev-Cpp\Untitled1.cpp expected constructor, destructor, or type conversion before '.' token
    14 C:\Dev-Cpp\Untitled1.cpp expected `,' or `;' before '.' token

    This continues for every line

  4. #4
    C++ Beginner
    Join Date
    Jun 2005
    Posts
    39
    This is the whole code on Dev-C++ right now:

    Code:
    #include <windows.h>
    class CApp
    {
    public:
      int Main(HINSTANCE hInstance, LPSTR lpCmdLine, int nCmdShow);
    };
    WNDCLASSEX wcex;
    HWND hWnd;message window
    
    // Register the Windows class:
    
    wcex.cbSize = sizeof(WNDCLASSEX); 
    wcex.style         = CS_HREDRAW; 
    wcex.lpfnWndProc   = (WNDPROC) GlobalWndProc;
    wcex.cbClsExtra    = 0;
    wcex.cbWndExtra    = 0;
    wcex.hInstance     = hInstance;
    wcex.hIcon         = NULL;
    wcex.hCursor       = LoadCursor(NULL, IDC_ARROW);
    wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
    wcex.lpszMenuName  = NULL;
    wcex.lpszClassName = WINDOW_CLASS;
    wcex.hIconSm       = NULL;
    
    if (!RegisterClassEx(&wcex))
      return 0;
    
    // Create the Window
    hWnd = CreateWindowEx(NULL, WINDOW_CLASS,
        Pokemon RPG, WS_OVERLAPPED, 
        GetSystemMetrics(SM_CXSCREEN) / 2 - 300 / 2,
        GetSystemMetrics(SM_CYSCREEN) / 2 - 200 / 2,
        300, 200, NULL, NULL, hInstance, this);
    
    if(!hWnd) return 0;
    ShowWindow(hWnd, SW_SHOW);
    UpdateWindow(hWnd);
    
    // Go into the message loop
    
    MSG msg;
    
    while(GetMessage(&msg, NULL, 0, 0))
    {
       TranslateMessage(&msg);
       DispatchMessage(&msg);
    }
    
    return 1;
    It's the same thing..
    Untitled1.cpp:3: error: `message' does not name a type
    Untitled1.cpp:8: error: expected constructor, destructor, or type conversion before '.' token
    Untitled1.cpp:8: error: expected `,' or `;' before '.' token
    Untitled1.cpp:9: error: expected constructor, destructor, or type conversion before '.' token
    Untitled1.cpp:9: error: expected `,' or `;' before '.' token
    Untitled1.cpp:10: error: expected constructor, destructor, or type conversion before '.' token
    Untitled1.cpp:10: error: expected `,' or `;' before '.' token
    Untitled1.cpp:11: error: expected constructor, destructor, or type conversion before '.' token
    Untitled1.cpp:11: error: expected `,' or `;' before '.' token

    Untitled1.cpp:12: error: expected constructor, destructor, or type conversion before '.' token

    Untitled1.cpp:12: error: expected `,' or `;' before '.' token
    Untitled1.cpp:13: error: expected constructor, destructor, or type conversion before '.' token
    Untitled1.cpp:13: error: expected `,' or `;' before '.' token
    Untitled1.cpp:14: error: expected constructor, destructor, or type conversion before '.' token
    Untitled1.cpp:14: error: expected `,' or `;' before '.' token
    Untitled1.cpp:15: error: expected constructor, destructor, or type conversion before '.' token
    Untitled1.cpp:15: error: expected `,' or `;' before '.' token
    Untitled1.cpp:16: error: expected constructor, destructor, or type conversion before '.' token
    Untitled1.cpp:16: error: expected `,' or `;' before '.' token
    Untitled1.cpp:17: error: expected constructor, destructor, or type conversion before '.' token
    Untitled1.cpp:17: error: expected `,' or `;' before '.' token
    Untitled1.cpp:18: error: expected constructor, destructor, or type conversion before '.' token
    Untitled1.cpp:18: error: expected `,' or `;' before '.' token
    Untitled1.cpp:20: error: expected unqualified-id before "if"
    Untitled1.cpp:20: error: expected `,' or `;' before "if"
    Untitled1.cpp:24: error: expected constructor, destructor, or type conversion before '=' token
    Untitled1.cpp:24: error: expected `,' or `;' before '=' token

    Untitled1.cpp:30: error: expected unqualified-id before "if"
    Untitled1.cpp:30: error: expected `,' or `;' before "if"
    Untitled1.cpp:31: error: expected constructor, destructor, or type conversion before '(' token
    Untitled1.cpp:31: error: expected `,' or `;' before '(' token
    Untitled1.cpp:32: error: expected constructor, destructor, or type conversion before '(' token
    Untitled1.cpp:32: error: expected `,' or `;' before '(' token
    Untitled1.cpp:38: error: expected unqualified-id before "while"
    Untitled1.cpp:38: error: expected `,' or `;' before "while"
    Untitled1.cpp:44: error: expected unqualified-id before "return"
    Untitled1.cpp:44: error: expected `,' or `;' before "return"

    can somebody test this on their dev-c++ and tell me if it works, because I don't understand this at all. HELP PLEASE!

  5. #5
    The N00b That Owns You!
    Join Date
    Jul 2005
    Location
    Canada!
    Posts
    178
    ill give it a shot brb

  6. #6
    The N00b That Owns You!
    Join Date
    Jul 2005
    Location
    Canada!
    Posts
    178
    npot just you its with the code i noticed: 8 C:\Programming\My Programs\hooah.cpp `message' does not name a type which is outta my league so there you have it not just you

  7. #7
    *this
    Join Date
    Mar 2005
    Posts
    498
    Sorry but where is WinMain ????

    Can't really create a win32API program without it.
    Check out dev's template for a windows program and you will find the answeres to your errors.

  8. #8
    The N00b That Owns You!
    Join Date
    Jul 2005
    Location
    Canada!
    Posts
    178
    oooo *smacks myself* i forgot WinMain is the equivilent of int main for windows and thus you need WinMain to use the prog. i havent started win32api yet and i know that jeesh lol next time ill examine the code even if its not code i understand lol

  9. #9
    The N00b That Owns You!
    Join Date
    Jul 2005
    Location
    Canada!
    Posts
    178
    and were is dev's template?

  10. #10
    C++ Beginner
    Join Date
    Jun 2005
    Posts
    39
    well i got that code off of http://www.gamedev.net/reference/pro...atures/mudpie1
    so I guess that their wrong =\

  11. #11
    The N00b That Owns You!
    Join Date
    Jul 2005
    Location
    Canada!
    Posts
    178
    so then stuff it in their face "YOUR CODE LED ME TO HAVING A BIG HASSALE AND HAVING ME TO POST A THREAD I HOPE YOUR HAPPY! " LMAO!

  12. #12
    C++ Beginner
    Join Date
    Jun 2005
    Posts
    39
    lol

  13. #13
    The N00b That Owns You!
    Join Date
    Jul 2005
    Location
    Canada!
    Posts
    178
    Quote Originally Posted by C+noob
    so then stuff it in their face "YOUR CODE LED ME TO HAVING A BIG HASSALE AND HAVING ME TO POST A THREAD I HOPE YOUR HAPPY! " LMAO!
    add "IF YOUR GOING TO POST CODE YOU MIGHT WANNA COMPILE IT FIRST!"

  14. #14
    *this
    Join Date
    Mar 2005
    Posts
    498
    Quote Originally Posted by C+noob
    and were is dev's template?
    If you create a win32API project it will give you code for registering a window (a fixed version of what you had) lol

  15. #15
    Registered User
    Join Date
    Apr 2005
    Posts
    3
    Renegade in your above post where you posted your code if thats the only thing in your project then of course it won't compile. You never finished the tutorial...

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

Similar Threads

  1. how to make a windows application
    By crvenkapa in forum C++ Programming
    Replies: 3
    Last Post: 03-26-2007, 09:59 AM
  2. Script errors - bool unrecognized and struct issues
    By ulillillia in forum Windows Programming
    Replies: 10
    Last Post: 12-18-2006, 03:44 AM
  3. Question..
    By pode in forum Windows Programming
    Replies: 12
    Last Post: 12-19-2004, 06:05 PM
  4. IE 6 status bar
    By DavidP in forum Tech Board
    Replies: 15
    Last Post: 10-23-2002, 05:31 PM
  5. Manipulating the Windows Clipboard
    By Johno in forum Windows Programming
    Replies: 2
    Last Post: 10-01-2002, 09:37 AM

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