cancel
Showing results for 
Search instead for 
Did you mean: 

I inquire about TouchGFX Compile error.

mSH.1
Associate III

hello

I inquire about TouchGFX Compile error.

To call a specific function by including discovery.h in Model.cpp

A compile error occurs.

However, in CubeIDE, it compiles normally and runs well.​

I want to know why a compile error occurs in TouchGFX and a normal compile in CubeIDE.

1.The development environment is as follows

  • STM32H725g-dk
  • CubleIDE 1.9.0
  • TouchGFX 4.19.1​

​2. The source of model.cpp is as follows.

===================================================================

#ifndef SIMULATOR

extern "C" {

#include "stm32H7xx.h"

#include "stm32h735g_discovery.h"

}

#endif

void Model::tick()

{

#ifndef SIMULATOR

  int button_sample = BSP_PB_GetState(BUTTONn); //BUTTONn // BUTTON_USER

  if (button_sample != 0x000F)

  {

    if( buttonState != button_sample )

    {

    modelListener->PUI_data(button_sample);

    buttonState = button_sample;

    }

  }

  else

  {

  buttonState = button_sample;

  }

}

​===================================================================

3.The error message in TouchGFX is as follows.

===================================================================

Compile

    make -f ../gcc/Makefile -j8

    Reading TouchGFX/application.config

    Compiling TouchGFX/gui/src/scrtopcook_screen/ScrTopCookView.cpp

    Compiling TouchGFX/gui/src/scrtopcook_screen/ScrTopCookPresenter.cpp

    Compiling TouchGFX/generated/gui_generated/src/scrbottom_screen/ScrBottomViewBase.cpp

    Compiling TouchGFX/generated/gui_generated/src/scrtopcook_screen/ScrTopCookViewBase.cpp

    Compiling TouchGFX/generated/gui_generated/src/scrtopset_screen/ScrTopSetViewBase.cpp

    Compiling TouchGFX/generated/gui_generated/src/scrauto_screen/ScrAutoViewBase.cpp

    Compiling TouchGFX/generated/gui_generated/src/scrmain_screen/ScrMainViewBase.cpp

    Compiling TouchGFX/generated/gui_generated/src/common/FrontendApplicationBase.cpp

    Compiling TouchGFX/generated/gui_generated/src/scrtop_screen/ScrTopViewBase.cpp

    Compiling TouchGFX/generated/gui_generated/src/scrloading_screen/ScrLoadingViewBase.cpp

    Compiling TouchGFX/generated/images/src/image_Pause.cpp

    Compiling TouchGFX/generated/images/src/BitmapDatabase.cpp

    Compiling TouchGFX/generated/images/src/image_restart.cpp

    Compiling TouchGFX/target/generated/TouchGFXGeneratedHAL.cpp

    Compiling TouchGFX/target/generated/TouchGFXConfiguration.cpp

    Linking TouchGFX/build/bin/target.elf

    TouchGFX/build/STM32H735G-DK/TouchGFX/gui/src/model/Model.o: In function `Model::tick()':

    c:\TouchGFXProjects\Noble_cooker/TouchGFX/gui/src/model/Model.cpp:29: undefined reference to `BSP_PB_GetState'

    collect2.exe: error: ld returned 1 exit status

    gcc/Makefile:293: recipe for target 'TouchGFX/build/bin/target.elf' failed

    make[2]: *** [TouchGFX/build/bin/target.elf] Error 1

    gcc/Makefile:289: recipe for target 'generate_assets' failed

    make[1]: *** [generate_assets] Error 2

    ../gcc/Makefile:49: recipe for target 'all' failed

    make: *** [all] Error 2

===================================================================

7 REPLIES 7
MM..1
Chief III

TouchGFX use different makefile as CUBE. You need add search path to added headers and add source files into TGFX makefile.

mSH.1
Associate III

thank you for your reply.

I don't know how to modify the makefile in TouchGFX.

Are there any guides provided?

@MM..1​  but the posted error is not about problems finding a header file?

@mSH.1​ "To call a specific function by including discovery.h in Model.cpp A compile error occurs. However, in CubeIDE, it compiles normally and runs well.​"

So the TouchGFX build is C++ - is the CubeIDE build also C++, or just plain C ?

This doesn't look right:

#ifndef SIMULATOR
extern "C" {
#include "stm32H7xx.h"
#include "stm32h735g_discovery.h"
}
#endif

Did you mean:

#ifdef __cplusplus
extern "C"
{
#endif
 
#include "stm32H7xx.h"
#include "stm32h735g_discovery.h"
 
#ifdef __cplusplus
}
#endif

0693W000008xsqBQAQ.png@mSH.1

hello ​@Andrew Neil​ 

Thanks for the useful feature.

As I was informed, the moel.cpp part was modified as follows.​

#ifdef __cplusplus
extern "C"
{
#endif
 
#include "stm32H7xx.h"
#include "stm32h735g_discovery.h"
 
#ifdef __cplusplus
}
#endif

But the same error occurs.

​It occurs only in touchGFX and compiles normally in CubeIDE.

​The error message in TouchGFX is as follows.

Run Simulator
    Generate
        Done
    Generate Assets
        make -f simulator/gcc/Makefile assets -j8
        Reading ./application.config
        Done
    Post Generate
        touchgfx update_project --project-file=simulator/msvs/Application.vcxproj
        Done
    Post Generate Target
        touchgfx update_project
        .project files generated inside project folder
        This is STM32CubeIDE project updater: Working on ../STM32CubeIDE/.project
        .cproject file: ../STM32CubeIDE/.cproject
        Float ABI: hard
        Writing STM32CubeIDE project file: ../STM32CubeIDE/.project
        Writing STM32CubeIDE project file: ../STM32CubeIDE/.cproject
        Done
    Compile
        make -f simulator/gcc/Makefile -j8
        Reading ./application.config
        Compiling gui/src/scrbottom_screen/ScrBottomView.cpp
        Compiling gui/src/scrbottom_screen/ScrBottomPresenter.cpp
        Compiling gui/src/scrtopcook_screen/ScrTopCookView.cpp
        Compiling gui/src/scrtopcook_screen/ScrTopCookPresenter.cpp
        Compiling gui/src/containers/CustomContainer_temp_wheel.cpp
        Compiling gui/src/scrtopset_screen/ScrTopSetPresenter.cpp
        Compiling gui/src/scrtopset_screen/ScrTopSetView.cpp
        Compiling gui/src/model/Model.cpp
        gui/src/model/Model.cpp:18:10: fatal error: stm32H7xx.h: No such file or directory
         #include "stm32H7xx.h"
                  ^~~~~~~~~~~~~
        compilation terminated.
        generated/simulator/gcc/Makefile:196: recipe for target 'build/MINGW32_NT-6.2/gui/src/model/Model.o' failed
        make[2]: *** [build/MINGW32_NT-6.2/gui/src/model/Model.o] Error 1
        make[2]: *** Waiting for unfinished jobs....
        generated/simulator/gcc/Makefile:155: recipe for target 'generate_assets' failed
        make[1]: *** [generate_assets] Error 2
        simulator/gcc/Makefile:32: recipe for target 'all' failed
        make: *** [all] Error 2
        Failed
    Failed

@mSH.1​ "As I was informed, the moel.cpp part was modified as follows"

I don't know the context of that snippet, so don't know if it's actually what you wanted - but certainly the original didn't look right.

There may be other places in your code with similar issues?

Do you understand the issues of mixing C and C++, and why/when the extern "C" is required?

You are now getting errors due to not finding header files - so, as @MM..1​  said, you do need to adjust your include paths...

Don’t waste time. Build custom project only in Cube.
In TouchGFX you need reconfigure build command to use Cube headless build. If you need this click...