Building TouchGFX in Clion, compiler says multiple definition of functions in OSWrappers.cpp
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-04-30 08:44 AM
I'm trying to start a project using TouchGFX on stm32H743IIT6 and I generated the project with CubeMX, and when I try to build the project with Clion, there are errors about simulator source files.So I excluded all directories about simulators in cmakelists, and compiling seems to work but there are errors of multiple definition of functions, and after checking, I found that all these multiple definition errors are related to functions in OSWrappers.cpp and OSWrappers_cmsis.cpp. Then I tried to open project in CubeIDE and compile with it, and there are no errors this time, everything is fine. I also tried to generate the project in MDK-ARM form and build it in Keil, still no problem. It seems only Clion can't build the project properly and I'm wondering if there's a way to compile in Clion.
Here are the changes I made in Cmakelists:
file(GLOB_RECURSE excludes "Middlewares/ST/touchgfx/framework/source/platform/hal/simulator/*.*" "Middlewares/ST/touchgfx/framework/source/platform/driver/touch/SDL2TouchController.cpp" "TouchGFX/generated/simulator/*.*" "TouchGFX/simulator/*.*")
list(REMOVE_ITEM SOURCES ${excludes})
added after
file(GLOB_RECURSE SOURCES "TouchGFX/*.*" "Core/*.*" "Middlewares/*.*" "Drivers/*.*")
- Labels:
-
STM32CubeMX
-
TouchGFX
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-05-01 02:55 AM
Hello @VanSharkholme ,
I have seen a reddit post where someone is asking the same thing and he seemed to not have a lot of success.
Furthermore, TouchGFX is supported for:
- Keil μVision (Target only)
- IAR Embedded Workbench (Target only)
- STM32CubeIDE (Target only)
- Microsoft Visual Studio (Simulator only)
That being said, we have documentation about using IDEs : using-ides-with-touchgfx
To use another IDE, you first need to use the correct compiler. Good for you, JetBrains also have documentation about that : how-to-switch-compilers-in-clion .
Basically, you need to set the same gcc as the one we are using.
After that you also need to use our Makefile. I saw that you mentioned a CMake file. TouchGFX do not use CMake, I cannot confirm the compatibility (or rather portability).
Then you also have to specify your cortex.
Overall, it seems like a quite complex and time consuming task.
If you can avoid it, I would recommend to.
Personally, I edit my code using VSCode and then I compile using whatever IDE I want based on the compiler I need.
Since you need GCC, I would recommend you to edit your code in CLion and then opening back your project in Designer and flashing from there.
I hope this helps, if the solves your problem, I invite you to select this comment as "best solution".
Regards,
Software engineer at ST (TouchGFX)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-05-01 03:59 AM
My project also uses CMake (in combination with VS-Code).
First you need to verify whether your build setup is correctly configured.
Easiest way is to build an hello world application with some blinking LEDs.
Next step is to add TouchGFX to the project, in general I would recommend you to avoid glob.
You should not build both `OSWrappers.cpp` and `OSWrappers_cmsis.cpp`, check which one is used in the CubeIDE project.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-05-01 06:45 AM
Thanks for reply, after reading your suggestions, I tested My Clion build setup and it should be fine since I managed to build simple projects generated from CubeMX. After this, I excluded files in TouchGFX/target and OSWrappers_cmsis.cpp, and now the problem is undefined reference about some functions. Maybe it's because of the generated Cmakelists contains problems? Should I attempt to write my own Cmakelists?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-05-01 06:49 AM
Hello @GaetanGodart ,
I understand what you mean now, porting the make files does seem kinda tricky, so I'm gonna try working on this for a while and if it still doesn't work out in next few days, I'll just compile with some other IDEs.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-05-01 10:45 PM
I do not have any experience with generated CMakeLists. In general ST only just started with some support for CMake, will take some time before it gets mature. If you have undefined references you have to add the missing files to the CMakeLists.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-06-06 05:54 AM
Hello @VanSharkholme ,
Have you been able to move forward regarding your question?
Regards,
Software engineer at ST (TouchGFX)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-06-20 02:04 AM
Hello @VanSharkholme ,
Have a look at this post : community.st.com/t5/stm32-mcus-touchgfx-and-gui/how-to-set-up-touchgfx-for-stm32cubemx-generated-cmake-project/td-p/678889
Aquamarine explains how he was able to generate code and flash it by using VSCode.
Regards,
Software engineer at ST (TouchGFX)