.c in project

Discussion in 'Mac Programming' started by Miglu, Jul 14, 2011.

  1. Miglu macrumors member

    Joined:
    Jan 22, 2010
    #1
    I have a C file in a project and when I build I get these errors in it:
    "Unknown type name 'bool'"
    "Use of undeclared identifier 'NULL'"
    "Variable has incomplete type 'void'"

    What is the problem?
     
  2. gnasher729 macrumors P6

    gnasher729

    Joined:
    Nov 25, 2005
    #2
    Missing include files.
     
  3. Hansr macrumors 6502a

    Joined:
    Apr 1, 2007
    #3
    Read your question. What would you do if someone asked that without supplying code and where they originate from?

    There is no bool keyword in C, but you can define it: http://c-faq.com/bool/index.html or include stdbool.h
     
  4. Miglu, Jul 14, 2011
    Last edited: Jul 14, 2011

    Miglu thread starter macrumors member

    Joined:
    Jan 22, 2010
    #4
    Thanks. I solved the first and second by including stdbool and stddef. How to remove the third one? Including stdlib does not work.
    Code:
    void APIENTRY TessErrorCallback(GLenum errorCode)
    {
    	__tess_err = gluErrorString(errorCode);
    }
    "expected ';' after top level declarator"
    "variable has incomplete type 'void'"
     
  5. chown33 macrumors 604

    Joined:
    Aug 9, 2009
    #5
    Exactly which line or lines do the error messages refer to?

    Post the code that comes before this function.

    Post the complete declaration for __tess_err (its type and storage class, extern or static; are any macros or other typedefs involved?).

    Is gluErrorString() declared or not?
     
  6. Miglu thread starter macrumors member

    Joined:
    Jan 22, 2010
    #6
    I noticed that actually the void error occurs on all of the void functions in the file, not just that one. It occurs in the part that is before { (what is that part called?).
    The functions have different arguments.
     
  7. Miglu thread starter macrumors member

    Joined:
    Jan 22, 2010
    #7
    The problem was that the functions had the word APIENTRY, which is only used in Windows. It was there because I did not write the code.
     
  8. mfram macrumors 65816

    Joined:
    Jan 23, 2010
    Location:
    San Diego, CA USA
    #8
    Just add...

    Code:
    #define APIENTRY
    somewhere in a header file or your code. Will take care of the issue.
     

Share This Page