- #include
- #include "../../Core/Inc/hello.h" // NO in simulator TouchGFX, Yes in CUBEIDEMX
- extern int myvar; // NO in simulator TouchGFX, Yes in CUBEIDEMX
- Screen1View::Screen1View()
- {
- }
- void Screen1View::setupScreen()
- {
- Screen1ViewBase::setupScreen();
- }
- void Screen1View::tearDownScreen()
- {
- Screen1ViewBase::tearDownScreen();
- }
- void Screen1View::simpleFunc()
- {
- ciao(); // err in simulator TouchGFX
- myvar = 7; // err in simulator TouchGFX
- }
- #include "hello.h"
- int myvar = 0;
- void ciao(void)
- {
- }
- #ifndef APPLICAtiON_USER_HELLO_H_
- #define APPLICATION_USER_HELLO_H_
- #ifdef __cplusplus
- extern "C" {
- #endif
- void ciao(void);
- #ifdef __cplusplus
- }
- #endif
- #endif /* APPLICATION_USER_HELLO_H_ */
- #include
- #include
- #include "BitmapDatabase.hpp"
- Screen1ViewBase::Screen1ViewBase() :
- buttonCallback(this, &Screen1ViewBase::buttonCallbackHandler)
- {
- box1.setPosition(0, 0, 240, 320);
- box1.setColor(touchgfx::Color::getColorFrom24BitRGB(255, 255, 255));
- button1.setXY(35, 130);
- button1.setBitmaps(touchgfx::Bitmap(BITMAP_BLUE_BUTTONS_ROUND_EDGE_SMALL_ID), touchgfx::Bitmap(BITMAP_BLUE_BUTTONS_ROUND_EDGE_SMALL_PRESSED_ID));
- button1.setAction(buttonCallback);
- add(box1);
- add(button1);
- }
- void Screen1ViewBase::setupScreen()
- {
- }
- void Screen1ViewBase::buttonCallbackHandler(const touchgfx::AbstractButton& src)
- {
- if (&src == &button1)
- {
- //Interaction1
- //When button1 clicked call virtual function
- //Call simpleFunc
- simpleFunc();
- }
- }
在 CUBEIDEMX works 中编译,在 TOUCHGFX NO 中运行模拟器
错误:
#include "../../Core/Inc/hello.h"
或在
外部内部 myvar;