Using utils/Errors.h in c code

227 views
Skip to first unread message

priya.bala...@wipro.com

unread,
Dec 14, 2010, 7:17:34 AM12/14/10
to android-...@googlegroups.com, android-...@googlegroups.com

Hi,

I have a "C" code where I have done the following.

#include <utils/Errors.h>

#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */

// My code

#ifdef __cplusplus
}
#endif /* __cplusplus */

I have included the required libraries too in make file

LOCAL_SHARED_LIBRARIES := \
    libcutils \
    libutils


However, upon compilation, I get the following error as I use the definitions given in utils/Errors.h file.

frameworks/base/include/utils/Errors.h:23: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'android'

Kindly let me know how to resolve this

Thanks and Regards,
Priya

ryanarn

unread,
Dec 21, 2010, 10:52:17 AM12/21/10
to android-...@googlegroups.com, android-...@googlegroups.com
Last time I checked, C didn't support C++ style namespaces and this error indicates to me that you're compiling your code with a C compiler, .e.g., gcc, and not a C++ compiler, e.g., g++.

Ryan
Reply all
Reply to author
Forward
0 new messages