使用C++开发STM32。
需要解决C++文件生成的问题
STM32CubeIDE V1.9.0 编译链:gcc g++
三、解决办法C++源文件和头文件放在CPP文件夹中
- 工程转换成C++
- 右键工程
- Convert to C++
- 创建C++的文件夹CPP
- 右键工程
- New
- Source Folder
- 设置开发环境,将该文件放入
- 右键工程
- Properties
- C/C++ General
- Paths and Symbols
- Includes
- GNU C++
- Add 选中CPP文件夹
- 在CPP文件夹中,创建C++头文件Cpp.h,编写内容如下:
// Cpp.h #ifndef CPP_H_ #define CPP_H_ #ifdef __cplusplus // 写一些C++的事情 #endif #endif
- 创建C++源文件Cpp.cpp,
#include "Cpp.h" // 写一些C++的事情



