cancel
Showing results for 
Search instead for 
Did you mean: 

'atexit' was not declared in this scope

nico23
Associate III

I'm trying to build myself a TouchGFX project

The project runs and builds correctly via TouchGFX Designer but I'm unable to compile it with VSCode (cmake, ninja gcc)

 

 

[build] C:/TouchGFXProjects/Circle_UI/Middlewares/ST/touchgfx/framework/source/platform/hal/simulator/sdl2/OSWrappers.cpp: In static member function 'static void touchgfx::OSWrappers::initialize()':
[build] C:/TouchGFXProjects/Circle_UI/Middlewares/ST/touchgfx/framework/source/platform/hal/simulator/sdl2/OSWrappers.cpp:24:24: error: 'atexit' was not declared in this scope
[build]      atexit(deinitialize);
[build]                         ^
[build] [174/177] Building CXX object CMakeFiles/TouchGFX.dir/C_/TouchGFXProjects/Circle_UI/Middlewares/ST/touchgfx/framework/source/platform/hal/simulator/sdl2/HALSDL2_icon.cpp.obj
[build] [175/177] Building CXX object CMakeFiles/TouchGFX.dir/C_/TouchGFXProjects/Circle_UI/Middlewares/ST/touchgfx/framework/source/platform/hal/simulator/sdl2/HALSDL2.cpp.obj
[build] C:/TouchGFXProjects/Circle_UI/Middlewares/ST/touchgfx/framework/source/platform/hal/simulator/sdl2/HALSDL2.cpp: In member function 'virtual bool touchgfx::HALSDL2::sdl_init(int, char**)':
[build] C:/TouchGFXProjects/Circle_UI/Middlewares/ST/touchgfx/framework/source/platform/hal/simulator/sdl2/HALSDL2.cpp:314:21: warning: unused variable 'transfer_thread' [-Wunused-variable]
[build]          SDL_Thread* transfer_thread = SDL_CreateThread(transferThreadFunc, "FB TransferThread", (void*)NULL);
[build]                      ^~~~~~~~~~~~~~~
[build] [176/177] Building CXX object CMakeFiles/TouchGFX.dir/simulator/main.cpp.obj
[build] ninja: build stopped: subcommand failed.

 

 versions are:

  • cmake version 3.29.3
  • ninja version 1.12.1
  • gcc.exe (MinGW.org GCC-6.3.0-1) 6.3.0
8 REPLIES 8
EmbDev
Senior

In my setup I only build for the target using CMake. When I want to run / debug the stimulator I just use the Makefile that is generated by the Designer (simulator/gcc/Makefile). Maybe you can also check the differences between the Makefile and your CMakeLists.txt.

Could you please go a bit more in deep on how you do the  run / debug of the simulator with the Makefile?

GaetanGodart
ST Employee

Hello @nico23 ,

 

I cannot help you with that, but @Aquamarine is also trying to compile TouchGFX projects on VSCode.

 

Regards,

Gaetan Godart
Software engineer at ST (TouchGFX)

Thanks, I'll look into it

I was following this tutorial/project built by one of your employees but it seems outdated and it generates exactly my error 

https://github.com/MaJerle/touchgfx-cmake-vscode-stm32-simulator

 

Yes this project seems to be 2 years old, things have changed since then.

I think it can still be a good starting point but it is only for simulator.

Gaetan Godart
Software engineer at ST (TouchGFX)
Aquamarine
Associate II

I'm trying to build TouchGFX with STM32 using VS Code and is able to archive build pass using https://github.com/MaJerle/touchgfx-cmake-vscode-stm32-simulator , However, I never tried building standalone TouchGFX project nor simulator.

I encountered similar problem during my set up, in this case, I would try to search the definition of atexit and check if it's corresponding source file was there or was in the build list.

This is my post if you think it might be useful: https://community.st.com/t5/stm32-mcus-touchgfx-and-gui/how-to-set-up-touchgfx-for-stm32cubemx-generated-cmake-project/td-p/678889

Thanks!

Yes, my goal was to build and debug the simulator via VSCode.


@Aquamarine wrote:

I encountered similar problem during my set up, in this case, I would try to search the definition of atexit and check if it's corresponding source file was there or was in the build list.


I'll try to have a look at the MakeList file, maybe is missing something

The atexit method is not part of the TouchGFX project, but a system include which should be part of your compiler.
Will share my non-CMake approach later here, when I have some time.