function-definition is not allowed here ?

This is a discussion on function-definition is not allowed here ? within the Windows Programming forums, part of the Platform Specific Boards category; Code: LRESULT CALLBACK MDIChildWndProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { switch(msg) { .... BOOL SetUpMDIChildWindowClass(HINSTANCE hInstance) { ...

  1. #1
    Registered User kryptkat's Avatar
    Join Date
    Dec 2002
    Posts
    638

    function-definition is not allowed here ?

    Code:
    LRESULT CALLBACK MDIChildWndProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) 
    {
    	switch(msg)
    	{
    
    ....
    
    BOOL SetUpMDIChildWindowClass(HINSTANCE hInstance)
    {
    	WNDCLASSEX wc;
    
    	wc.cbSize		 = sizeof(WNDCLASSEX);
    i am getting a function-definition is not allowed here before '{' token
    in many lines like the above two using dev-cpp
    i do not understand why. i do this with borland meow and it compiles fine.
    so what do i have to do to get these functions to work with dev-cpp?

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    "function definition not allowed here" sounds like you have a mismatched brace situation.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  3. #3
    CSharpener vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,458
    are all brackets closed properly and all headers have proper ; at the end?
    The first 90% of a project takes 90% of the time,
    the last 10% takes the other 90% of the time.

  4. #4
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    I'd put a few pence on vart's second suggestion, actually: missing semicolon in a header file.

    And I don't think dev-cpp is part of the problem at all - it's 99.999% sure to be some coding problem.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  5. #5
    Registered User kryptkat's Avatar
    Join Date
    Dec 2002
    Posts
    638
    thank you. checking....

  6. #6
    Registered User kryptkat's Avatar
    Join Date
    Dec 2002
    Posts
    638
    i commented out a bunch of lines and one of } but not one of { these. that did it.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Beginner Needs help in Dev-C++
    By Korrupt Lawz in forum C++ Programming
    Replies: 20
    Last Post: 09-28-2010, 01:17 AM
  2. HELP!! Function Definition problem? Syntax Error I think..
    By felixgun in forum C++ Programming
    Replies: 12
    Last Post: 11-04-2006, 03:49 AM
  3. load gif into program
    By willc0de4food in forum Windows Programming
    Replies: 14
    Last Post: 01-11-2006, 09:43 AM
  4. structure vs class
    By sana in forum C++ Programming
    Replies: 13
    Last Post: 12-02-2002, 06:18 AM
  5. Warnings, warnings, warnings?
    By spentdome in forum C Programming
    Replies: 25
    Last Post: 05-27-2002, 06:49 PM

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