Thread: how do I get rid of this warning?

  1. #1
    Registered User
    Join Date
    Jan 2008
    Posts
    569

    how do I get rid of this warning?

    I have a function which is:

    char *paramReturn( char *);

    and in the code somewhere I tried to do this:

    strcat(code,paramReturn(root->name) );


    and when I compile the code it gives me a warning :

    warning: passing argument 2 of āstrcatā makes pointer from integer without a cast


    how can I get rid of this warning?

  2. #2
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    Make sure the compiler can see the prototype of paramReturn (since it can't, it is assuming that paramReturn returns an int).

  3. #3
    Registered User
    Join Date
    Jan 2008
    Posts
    569
    how do I make sure of that? is it because I am declaring the function paramReturn in a different file that's why it can't see it?

  4. #4
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    If you are using a function in file blah.c, then you had darn well better include "blah.h" at the top.

  5. #5
    Jack of many languages Dino's Avatar
    Join Date
    Nov 2007
    Location
    Chappell Hill, Texas
    Posts
    2,332
    Are you #including that file?
    Mainframe assembler programmer by trade. C coder when I can.

  6. #6
    Registered User
    Join Date
    Jan 2008
    Posts
    569
    ok, I just did that and it works... however I've got another problem:

    I am building a parser and have write this in one of the rule:

    Code:
    | TFOR '(' stmnttemp1 ';'         ';' stmnttemp1 ')' stmt  
                                  {
                                  
                                  /* tree */
                                  $$.node = MakeTreeStmt($3.node,  NULL,      $6.node,  $8.node,      T_STMT_FOR,      NULL);
    
    }
    the error is at:
    Code:
     $$.node = MakeTreeStmt($3.node,  NULL,      $6.node,  $8.node,      T_STMT_FOR,      NULL);
    it always complaints the same error as above;

    warning: assignment makes pointer from integer without a cast

    I've already included the file where MakeTreeStnt is declared in the included up above, but it still shows the error... so is there any way to fix this?

  7. #7
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    And what is the actual C code that you are compiling, as what you have posted certainly isn't C.

    --
    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.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 10
    Last Post: 07-10-2008, 03:45 PM
  2. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 02:39 PM
  3. <Gulp>
    By kryptkat in forum Windows Programming
    Replies: 7
    Last Post: 01-14-2006, 01:03 PM
  4. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM
  5. Interface Question
    By smog890 in forum C Programming
    Replies: 11
    Last Post: 06-03-2002, 05:06 PM