.c in project

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

  1. Miglu macrumors member

    Jan 22, 2010
    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


    Nov 25, 2005
    Missing include files.
  3. Hansr macrumors 6502a

    Apr 1, 2007
    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

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

    Aug 9, 2009
    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

    Jan 22, 2010
    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

    Jan 22, 2010
    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

    Jan 23, 2010
    San Diego, CA USA
    Just add...

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

Share This Page