rect
Member
|
A lot macro redefinition error when I Include other library
Hi Esenthel.
My project want to use protobuf( https://github.com/google/protobuf ).
My project Setting is:
Code:
Include Libraries
E:\protobuf\lib\libprotobuf.lib | E:\protobuf\lib\libprotobuf-lite.lib | E:\
\protobuf\lib\libprotoc.lib
Include Directories
E:\protobuf\include
at Main I try to include a protobuf `s Hander File:
Code:
#include <google/protobuf/unknown_field_set.h>
check F5 to build,but the output show many error like:
Code:
1>------ Build started: Project: ProtoBufferTest, Configuration: Debug Win32 ------
1> Main.cpp
1>e:\tool\vs2012\vc\include\vadefs.h(48): error C2146: syntax error : missing ';' before identifier 'uintptr_t'
1>e:\tool\vs2012\vc\include\vadefs.h(48): error C2371: 'I32' : redefinition; different basic types
1> e:\code\engine\editor_20150414\bin\esenthelengine\_\types.h(14) : see declaration of 'I32'
1>e:\tool\vs2012\vc\include\vadefs.h(48): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>e:\tool\vs2012\vc\include\crtdefs.h(430): error C2146: syntax error : missing ';' before identifier 'size_t'
1>e:\tool\vs2012\vc\include\crtdefs.h(430): error C2371: 'I32' : redefinition; different basic types
1> e:\code\engine\editor_20150414\bin\esenthelengine\_\types.h(14) : see declaration of 'I32'
1>e:\tool\vs2012\vc\include\crtdefs.h(430): warning C4091: '' : ignored on left of 'unsigned int' when no variable is declared
1>e:\tool\vs2012\vc\include\crtdefs.h(475): error C2146: syntax error : missing ';' before identifier 'wint_t'
1>e:\tool\vs2012\vc\include\crtdefs.h(475): error C2371: 'I16' : redefinition; different basic types
1> e:\code\engine\editor_20150414\bin\esenthelengine\_\types.h(12) : see declaration of 'I16'
1>e:\tool\vs2012\vc\include\crtdefs.h(475): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>e:\tool\vs2012\vc\include\crtdefs.h(476): error C2146: syntax error : missing ';' before identifier 'wctype_t'
1>e:\tool\vs2012\vc\include\crtdefs.h(476): error C2371: 'I16' : redefinition; different basic types
1> e:\code\engine\editor_20150414\bin\esenthelengine\_\types.h(12) : see declaration of 'I16'
1>e:\tool\vs2012\vc\include\crtdefs.h(476): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>e:\tool\vs2012\vc\include\crtdefs.h(501): error C2347: '__w64' : can not be used with type '__w64 __int64'
1>e:\tool\vs2012\vc\include\crtdefs.h(576): error C2061: syntax error : identifier 'uintptr_t'
1>e:\tool\vs2012\vc\include\crtdefs.h(2001): error C2146: syntax error : missing ';' before identifier 'lc_codepage'
1>e:\tool\vs2012\vc\include\crtdefs.h(2001): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>e:\tool\vs2012\vc\include\crtdefs.h(2002): error C2146: syntax error : missing ';' before identifier 'lc_collate_cp'
1>e:\tool\vs2012\vc\include\crtdefs.h(2002): error C2086: 'unsigned int threadlocaleinfostruct::I32' : redefinition
1> e:\tool\vs2012\vc\include\crtdefs.h(2001) : see declaration of 'threadlocaleinfostruct::I32'
1>e:\tool\vs2012\vc\include\crtdefs.h(2002): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>e:\tool\vs2012\vc\include\crtdefs.h(2003): error C2146: syntax error : missing ';' before identifier 'lc_time_cp'
1>e:\tool\vs2012\vc\include\crtdefs.h(2003): error C2086: 'unsigned int threadlocaleinfostruct::I32' : redefinition
1> e:\tool\vs2012\vc\include\crtdefs.h(2001) : see declaration of 'threadlocaleinfostruct::I32'
1>e:\tool\vs2012\vc\include\crtdefs.h(2003): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>e:\tool\vs2012\vc\include\crtdefs.h(2005): error C2327: 'threadlocaleinfostruct::I32' : is not a type name, static, or enumerator
1>e:\tool\vs2012\vc\include\crtdefs.h(2006): error C2327: 'threadlocaleinfostruct::I32' : is not a type name, static, or enumerator
1>e:\tool\vs2012\vc\include\crtdefs.h(2007): error C2327: 'threadlocaleinfostruct::I32' : is not a type name, static, or enumerator
1>e:\tool\vs2012\vc\include\crtdefs.h(2008): error C2327: 'threadlocaleinfostruct::I32' : is not a type name, static, or enumerator
1>e:\tool\vs2012\vc\include\crtdefs.h(2009): error C2327: 'threadlocaleinfostruct::I32' : is not a type name, static, or enumerator
1>e:\tool\vs2012\vc\include\crtdefs.h(2011): error C2327: 'threadlocaleinfostruct::I32' : is not a type name, static, or enumerator
1>e:\tool\vs2012\vc\include\crtdefs.h(2012): error C2143: syntax error : missing ';' before '*'
1>e:\tool\vs2012\vc\include\crtdefs.h(2012): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>e:\tool\vs2012\vc\include\crtdefs.h(2013): error C2143: syntax error : missing ';' before '*'
1>e:\tool\vs2012\vc\include\crtdefs.h(2013): error C2734: 'threadlocaleinfostruct::I16' : const object must be initialized if not extern
1>e:\tool\vs2012\vc\include\crtdefs.h(2013): error C2373: 'threadlocaleinfostruct::I16' : redefinition; different type modifiers
1> e:\tool\vs2012\vc\include\crtdefs.h(2012) : see declaration of 'threadlocaleinfostruct::I16'
1>e:\tool\vs2012\vc\include\crtdefs.h(2013): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>e:\tool\vs2012\vc\include\crtdefs.h(2014): error C2143: syntax error : missing ';' before '*'
1>e:\tool\vs2012\vc\include\crtdefs.h(2014): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>e:\tool\vs2012\vc\include\crtdefs.h(2015): error C2143: syntax error : missing ';' before '*'
1>e:\tool\vs2012\vc\include\crtdefs.h(2015): error C2734: 'threadlocaleinfostruct::Char' : const object must be initialized if not extern
1>e:\tool\vs2012\vc\include\crtdefs.h(2015): error C2086: 'const unsigned int threadlocaleinfostruct::Char' : redefinition
1> e:\tool\vs2012\vc\include\crtdefs.h(2014) : see declaration of 'threadlocaleinfostruct::Char'
1>e:\tool\vs2012\vc\include\crtdefs.h(2015): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>e:\tool\vs2012\vc\include\xkeycheck.h(170): warning C4005: 'bool' : macro redefinition
1> e:\code\engine\editor_20150414\projects\_build_\protobuffertest\source\@@headers.h(2) : see previous definition of 'bool'
1>e:\tool\vs2012\vc\include\xkeycheck.h(174): warning C4005: 'char' : macro redefinition
1> e:\code\engine\editor_20150414\projects\_build_\protobuffertest\source\@@headers.h(5) : see previous definition of 'char'
1>e:\tool\vs2012\vc\include\xkeycheck.h(177): warning C4005: 'class' : macro redefinition
1> e:\code\engine\editor_20150414\projects\_build_\protobuffertest\source\@@headers.h(30) : see previous definition of 'class'
1>e:\tool\vs2012\vc\include\xkeycheck.h(200): warning C4005: 'int' : macro redefinition
1> e:\code\engine\editor_20150414\projects\_build_\protobuffertest\source\@@headers.h(11) : see previous definition of 'int'
1>e:\tool\vs2012\vc\include\xkeycheck.h(201): warning C4005: 'long' : macro redefinition
1> e:\code\engine\editor_20150414\projects\_build_\protobuffertest\source\@@headers.h(13) : see previous definition of 'long'
1>e:\tool\vs2012\vc\include\xkeycheck.h(216): warning C4005: 'short' : macro redefinition
1> e:\code\engine\editor_20150414\projects\_build_\protobuffertest\source\@@headers.h(9) : see previous definition of 'short'
1>e:\tool\vs2012\vc\include\xkeycheck.h(242): fatal error C1189: #error : The C++ Standard Library forbids macroizing keywords. Enable warning C4005 to find the forbidden macro.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
can U give me some suggestions to fix it ?
(This post was last modified: 05-14-2015 04:27 AM by rect.)
|
|
05-14-2015 04:25 AM |
|
Esenthel
Administrator
|
RE: A lot macro redefinition error when I Include other library
Hi,
You could try things like that:
#define I32 ExternalI32
#include "your custom library.h"
#undef I32
|
|
05-14-2015 10:02 PM |
|