我正在尝试使用 VS2017(和 VS2019RC/preview)构建一个项目/测试 cmake,并将 arm-none-eabi-gcc 作为我的编译器。
我很难告诉 VS2017 在哪里寻找默认的 gcc 标头。
实现这一目标的正确/最简单的方法是什么?
我正在尝试使用 VS2017(和 VS2019RC/preview)构建一个项目/测试 cmake,并将 arm-none-eabi-gcc 作为我的编译器。
我很难告诉 VS2017 在哪里寻找默认的 gcc 标头。
实现这一目标的正确/最简单的方法是什么?
所以我有一个解决方法,很好,工作。但这绝对不是长久之计。
我所做的是直接在CMakeLists.txt
'target_include_directories
指令中添加了 GCC 包含路径,并且有效。像这样:
target_include_directories(
${ELF}
PRIVATE
"source"
"source/target/arm/stm32f1/CMSIS/Device/ST/STM32F1xx/Include"
"${tools}\\bin\\../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/include/c++/7.3.1"
"${tools}\\bin\\../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/include/c++/7.3.1/arm-none-eabi"
"${tools}\\bin\\../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/include/c++/7.3.1/backward"
"${tools}\\bin\\../lib/gcc/arm-none-eabi/7.3.1/include"
"${tools}\\bin\\../lib/gcc/arm-none-eabi/7.3.1/include-fixed"
"${tools}\\bin\\../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/include"
)
但是,是的,没有人想要这样的解决方案。那么如果有人有更好的主意呢?
我知道我可以像常规包含一样包含它们,但尝试查找配置选项并在下面找到有关如何将其推送到 INCLUDE env 变量的链接。
https://devblogs.microsoft.com/cppblog/arm-gcc-cross-compilation-in-visual-studio/
您可以指定其他包含目录,但请注意,此时还必须显式声明存在的子目录。
[code lang=”js”]
{
// The "environments" property is an array of key value pairs of the form
// { "EnvVar1": "Value1", "EnvVar2": "Value2" }
"environments": [
{
"INCLUDE": "${workspaceRoot}\\src\\includes"
}
],
{
"configurations": [
{
"inheritEnvironments": [
"gcc-arm"
],
"name": "gccarm",
"includePath": [
"${env.INCLUDE}"
],
"defines": [
]
}
]
}