CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    Join Date
    Feb 2010
    Posts
    18

    error C2143: syntax error : missing ';' before 'type'

    hi,

    I am creating a GUI using VC++ as compiler, i have all C files. In one of the file where i created blank windows frame work(i created blank window). for write pixel i'm using a function(as application needs). so i included following function in windos frame work code and i'm getting the error :
    error C2143: syntax error : missing ';' before 'type'
    error C2059: syntax error : '}'

    function
    extern void Line(Coord,Coord,Coord,Coord,Color)
    {
    int x1,y1,xe1,ye1;
    MoveToEx(hDC,xe,ye,NULL);
    LineTo(hDC,x,y);
    }

    i am getting first error at start of function, and 2nd at end of the function line.

  2. #2
    Join Date
    Feb 2005
    Posts
    2,160

    Re: error C2143: syntax error : missing ';' before 'type'

    What is "function"? That's not a C/C++ keyword or any standard library typedef that I know of.

  3. #3
    Join Date
    Feb 2010
    Posts
    18

    Re: error C2143: syntax error : missing ';' before 'type'

    i am using function Line(Coord,Coord,Coord,Coord,Color) to draw some graphic. I know we can draw lines and all using msdn library(LineTo) directly. but my application need it to draw through function Line.

  4. #4
    Join Date
    Feb 2005
    Posts
    2,160

    Re: error C2143: syntax error : missing ';' before 'type'

    I don't have any idea what you are trying to do, but try removing the word "function". It's not a C/C++ keyword (I think it is in PASCAL).

  5. #5
    Join Date
    Oct 2006
    Location
    Sweden
    Posts
    3,654

    Re: error C2143: syntax error : missing ';' before 'type'

    No, PASCAL functions can't have void returns (at least not in the 15-20 year old PASCAL version I remember...)
    Debugging is twice as hard as writing the code in the first place.
    Therefore, if you write the code as cleverly as possible, you are, by
    definition, not smart enough to debug it.
    - Brian W. Kernighan

    To enhance your chance's of getting an answer be sure to read
    http://www.codeguru.com/forum/announ...nouncementid=6
    and http://www.codeguru.com/forum/showthread.php?t=366302 before posting

    Refresh your memory on formatting tags here
    http://www.codeguru.com/forum/misc.php?do=bbcode

    Get your free MS compiler here
    https://visualstudio.microsoft.com/vs

  6. #6
    Join Date
    Feb 2005
    Posts
    2,160

    Re: error C2143: syntax error : missing ';' before 'type'

    My parenthetical remark was ambiguous. I meant that "function" is a valid keyword in PASCAL. I should have prhased it: "(I think it is a keyword in PASCAL)".

    I suspect that the OP is confusing the two languages.

  7. #7
    Join Date
    Oct 2006
    Location
    Sweden
    Posts
    3,654

    Re: error C2143: syntax error : missing ';' before 'type'

    Ah! No, that was my bad reading. I totally mis-interpreted it, I see that now reading it a second time.
    Debugging is twice as hard as writing the code in the first place.
    Therefore, if you write the code as cleverly as possible, you are, by
    definition, not smart enough to debug it.
    - Brian W. Kernighan

    To enhance your chance's of getting an answer be sure to read
    http://www.codeguru.com/forum/announ...nouncementid=6
    and http://www.codeguru.com/forum/showthread.php?t=366302 before posting

    Refresh your memory on formatting tags here
    http://www.codeguru.com/forum/misc.php?do=bbcode

    Get your free MS compiler here
    https://visualstudio.microsoft.com/vs

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured