Like Tree2Likes
  • 2 Post By Elysia

Compilation Error

This is a discussion on Compilation Error within the C Programming forums, part of the General Programming Boards category; Please help me solve these problem, I could not understand why these errors ... Code: int return_pokebola(struct map_session_data *sd, struct ...

  1. #1
    Registered User
    Join Date
    Sep 2011
    Posts
    2

    Compilation Error

    Please help me solve these problem, I could not understand why these errors ...
    Code:
    int return_pokebola(struct map_session_data *sd, struct homun_data *hd)
    {
        hd = sd->hd;
    
        struct item tmp_item;
        int flag;
    
        memset(&tmp_item,0,sizeof(tmp_item));
        tmp_item.nameid = hd->homunculusDB->EggId;
        tmp_item.identify = 1;
        tmp_item.card[0] = CARD0_HUN;
        tmp_item.card[1] = GetWord(hd->homunculus.hom_id,0);
        tmp_item.card[2] = GetWord(hd->homunculus.hom_id,1);
        tmp_item.card[3] = hd->homunculus.rename_flag;
        if((flag = pc_additem(sd,&tmp_item,1))) {
            clif_additem(sd,0,0,flag);
            map_addflooritem(&tmp_item,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
        }
        hd->homunculus.vaporize = 1;
        return 1;
    }
    1>c:\users\mateus\desktop\renewall\src\map\homuncu lus.c(91): error C2143: syntax error : missing ';' before 'type'
    1>c:\users\mateus\desktop\renewall\src\map\homuncu lus.c(92): error C2143: syntax error : missing ';' before 'type'
    1>c:\users\mateus\desktop\renewall\src\map\homuncu lus.c(94): error C2065: 'tmp_item' : undeclared identifier
    1>c:\users\mateus\desktop\renewall\src\map\homuncu lus.c(94): error C2065: 'tmp_item' : undeclared identifier
    1>c:\users\mateus\desktop\renewall\src\map\homuncu lus.c(95): error C2065: 'tmp_item' : undeclared identifier
    1>c:\users\mateus\desktop\renewall\src\map\homuncu lus.c(95): error C2224: left of '.nameid' must have struct/union type
    1>c:\users\mateus\desktop\renewall\src\map\homuncu lus.c(96): error C2065: 'tmp_item' : undeclared identifier
    1>c:\users\mateus\desktop\renewall\src\map\homuncu lus.c(96): error C2224: left of '.identify' must have struct/union type
    1>c:\users\mateus\desktop\renewall\src\map\homuncu lus.c(97): error C2065: 'tmp_item' : undeclared identifier
    1>c:\users\mateus\desktop\renewall\src\map\homuncu lus.c(97): error C2224: left of '.card' must have struct/union type
    1>c:\users\mateus\desktop\renewall\src\map\homuncu lus.c(98): error C2065: 'tmp_item' : undeclared identifier
    1>c:\users\mateus\desktop\renewall\src\map\homuncu lus.c(98): error C2224: left of '.card' must have struct/union type
    1>c:\users\mateus\desktop\renewall\src\map\homuncu lus.c(99): error C2065: 'tmp_item' : undeclared identifier
    1>c:\users\mateus\desktop\renewall\src\map\homuncu lus.c(99): error C2224: left of '.card' must have struct/union type
    1>c:\users\mateus\desktop\renewall\src\map\homuncu lus.c(100): error C2065: 'tmp_item' : undeclared identifier
    1>c:\users\mateus\desktop\renewall\src\map\homuncu lus.c(100): error C2224: left of '.card' must have struct/union type
    1>c:\users\mateus\desktop\renewall\src\map\homuncu lus.c(101): error C2065: 'flag' : undeclared identifier
    1>c:\users\mateus\desktop\renewall\src\map\homuncu lus.c(101): error C2065: 'tmp_item' : undeclared identifier
    1>c:\users\mateus\desktop\renewall\src\map\homuncu lus.c(101): warning C4133: 'function' : incompatible types - from 'int *' to 'item *'
    1>c:\users\mateus\desktop\renewall\src\map\homuncu lus.c(102): error C2065: 'flag' : undeclared identifier
    1>c:\users\mateus\desktop\renewall\src\map\homuncu lus.c(103): error C2065: 'tmp_item' : undeclared identifier
    1>c:\users\mateus\desktop\renewall\src\map\homuncu lus.c(103): warning C4133: 'function' : incompatible types - from 'int *' to 'item *'

  2. #2
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,449
    Wrong forum -> this is C.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  3. #3
    Registered User
    Join Date
    Sep 2011
    Posts
    2
    Is not, so I'm using Microsoft C + +
    But I have seen the error can lock the topic ...

  4. #4
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,449
    Microsoft C++ does not exist. However, Microsoft has an IDE with a compiler typically named "Visual C++." Note, however, that this is a compiler and has nothing to do with the language you are writing in.
    You are writing C code, hence you should post question on the C board, and not the C++ board.
    Just having "C++" in the name does not make the language C++ which this board is reserved for.
    AndrewHunter and Salem like this.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  5. #5
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,451
    Agreed - Moved.

    > 1>c:\users\mateus\desktop\renewall\src\map\homunc u lus.c(91): error C2143: syntax error : missing ';' before 'type'
    > 1>c:\users\mateus\desktop\renewall\src\map\homunc u lus.c(92): error C2143: syntax error : missing ';' before 'type'
    See, this is why the language matters.
    Simply saying you're using "Visual C++" doesn't make your code C++.

    Code:
        hd = sd->hd;  // This is a statement
    
        struct item tmp_item; // These are declarations
        int flag;
    Traditional C89 C (the only flavour Microsoft supports) does NOT allow mixed declarations and statements.
    Within any block scope, all the declarations need to be first before you have any statements.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. compilation error
    By Annonymous in forum Networking/Device Communication
    Replies: 12
    Last Post: 06-27-2011, 07:20 PM
  2. Compilation Error
    By sunk22 in forum C Programming
    Replies: 9
    Last Post: 05-25-2011, 12:00 PM
  3. error: was not declared in this scope compilation error
    By i_r_tomash in forum C Programming
    Replies: 2
    Last Post: 05-27-2010, 07:44 AM
  4. compilation error
    By blue_gene in forum C++ Programming
    Replies: 3
    Last Post: 03-30-2004, 09:48 AM
  5. Error with compilation
    By mattbrrtt in forum C Programming
    Replies: 0
    Last Post: 01-08-2002, 03:44 AM

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