Skip to main content
INaka.1
Associate III
May 29, 2023
Solved

Dear friend: I've been working with the STM32CubeIDE V1.8.0 ( I've continued working with this version because I found some problems and, with your help it worked well) . I downloaded this week the v. 1.12.1 and I had a problem: In the older version,

define the global variables inside a variables.h file, and was possible to use within several procedures (*.c) only informing with #define "variables.h". In this version it isn't possible.

How can I declare the global variables ?

Thank you for your attention,

Best regards, Ilson

This topic has been closed for replies.
Tesla DeLorean
Tesla DeLoreanBest answer
Guru
May 29, 2023

Use extern definitions in the include file and define them ONCE in a SINGULAR .C file​

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..

4 replies

Graduate II
May 29, 2023

Hello. I think the change in GCC 10 to put -fno-common as default is causing your problems. CubeIDE 1.9.0 was first to use GCC 10 as default toolchain.

Try to add -fcommon flag to C/C++ miscellanous options.


_legacyfs_online_stmicro_images_0693W00000bl3yaQAA.pnghttps://gcc.gnu.org/gcc-10/porting_to.html

INaka.1
INaka.1Author
Associate III
May 29, 2023

Thank you for you attention. I'll see this suggestion.

Tesla DeLorean
Tesla DeLoreanBest answer
Guru
May 29, 2023

Use extern definitions in the include file and define them ONCE in a SINGULAR .C file​

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
INaka.1
INaka.1Author
Associate III
May 29, 2023

Thank you for your fast response.