problem with my MCUXPRESSO compiler C++

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

problem with my MCUXPRESSO compiler C++

Jump to solution
1,050 Views
mich28
Contributor II

hi, i have a problem with my MCUXPRESSO compiler, i instantiated my object before main through the constructor method, i put a breakpoint at the first instruction in main so i can read the values contained by the instantiated object and nothing, the object is completely empty, this object has been used for other compilers where i instantiated it before calling main with no problems.... i was wondering how i can fix this.

 

0 Kudos
Reply
1 Solution
1,024 Views
mich28
Contributor II

Caso risolto, non so per quale motivo mi trovavo nella cartella "startup" due file uno "startup_mkv42f16.c" e l'altro "startup_mkv42f16.cpp" semplicemente togliendo il file .c ho risolto il problema. Grazie!

View solution in original post

0 Kudos
Reply
3 Replies
1,025 Views
mich28
Contributor II

Hi, thanks for the reply, I created the project using the mcuxpresso configurator by selecting c++, but for some strange reason when I debug, I saw that the "startup_mkv42f16.c" file is called, I try to follow the link you sent me, if Advice comes to your mind and I gladly accept it. Thank you!

0 Kudos
Reply
1,027 Views
ErichStyger
Senior Contributor V

Are you using a startup code which has the C++ constructor calls implemented?

ErichStyger_0-1680700420903.png

 

If you are compiling/using a C startup code, it will not call the _libc_init_array().

If your project is a C project and you want to convert it into a C++ one, see https://mcuoneclipse.com/2020/07/11/from-c-to-c-converting-eclipse-c-projekts/

I hope this helps,

Erich

0 Kudos
Reply
1,025 Views
mich28
Contributor II

Caso risolto, non so per quale motivo mi trovavo nella cartella "startup" due file uno "startup_mkv42f16.c" e l'altro "startup_mkv42f16.cpp" semplicemente togliendo il file .c ho risolto il problema. Grazie!

0 Kudos
Reply