简体   繁体   中英

gcc compile with 32-bit architecture not working

I am trying to compile a C file with gcc. The code in header file will need specified architecture in order to compile.

#if defined( _8BIT_ARCHITECTURE )
 #include "type8.h"

#elif defined( _16BIT_ARCHITECTURE )
 #include "type16.h"

#elif defined( _32BIT_ARCHITECTURE )
 #include "type32.h"

#else
 #error ARCHITECTURE not defined
#endif

When using Visual Studio, I can configure the platform into 32-bit and it can build successfully. But how do I do the same thing with gcc commands?

I was trying to use:

gcc -m32 -c myFile.c -I /somePath/

But it keeps giving me the error statement:

 #error ARCHITECTURE not defined

Adding -D_32BIT_ARCHITECTURE fix the issue

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM