MFrancone
MFrancone

Reputation: 161

Macro visibility in CubeMx&Atollic bare project

I've created a simple CubeMx project from scratch and opened it up on Atollic TrueStudio. Of course, its compilation gets out successfully. I've been looking around in project's directories and files to better understand the bare structure upon constructing new projects.

I currently use a STM32 board equipped with a CortexM4 CPU and I'm programming in C with a GCC compiler. In the project, I've found a header file called core_cm4.h that is reach of macros declaration, i.e. #define statements. Here is where the odd thing comes up: when I try to use these macros within the main.c file (and in any other new file), they are all available and recognized but the following ones:

#elif defined ( __GNUC__ )
   #define __ASM            __asm          /*!< asm keyword for GNU Compiler */
   #define __INLINE         inline         /*!< inline keyword for GNU Compiler */
   #define __STATIC_INLINE  static inline

The __GNUC__ symbol is defined and the compiler does not report any warnings or errors. However the IDE does not offer these macros in the drop-down menù and signal the word as a syntax error.

I tried to move the declaration somewhere else within the core_cm4.h file unsuccessfully. Do I overlook something relevant?

Upvotes: 0

Views: 474

Answers (2)

theSealion
theSealion

Reputation: 1102

According to your answer, that the project compiles successfully:

Please try to "refresh all files" and afterwards "rebuild" the index.

(You could find this commands by right clicking on the project name in the project explorer) enter image description here

Upvotes: 0

Gabriel Staples
Gabriel Staples

Reputation: 52985

You said the __GNU__ symbol is defined, but the #elif is checking against __GNUC__, which is not the same thing. Is that a typo on your part?

Upvotes: 0

Related Questions