gpt4 book ai didi

c++ - 嵌入式 C/C++ Atollic

转载 作者:塔克拉玛干 更新时间:2023-11-03 07:43:29 26 4
gpt4 key购买 nike

在 atollic 中处理嵌入式 c++/c 项目时(eclipse 也一样),在项目设置下,您有:

> Assembler (arm-atollic-eabi-gcc -c)
> C Compiler (arm-atollic-eabi-gcc -c)
> C++ Compiler (arm-atollic-eabi-g++ -c)
> C++ Linker

这意味着,我可以在 c++ 项目中使用 C 代码而无需任何修改,因为所有 .c 文件都是用 gcc 编译的,所有 .cpp 文件都是用 g++ 编译的。此外,C 代码是否以及何时在 header 中包含 #if __cplusplus extern "C"{ 或者 .cpp 代码将包含 V 代码,如 "#如果 __cplusplus extern "C"{ #include "c_header.h"... 这绝对没有区别,因为 .c 文件是用 gcc 编译的,它没有定义 __cplusplus.

Is this correct??

当我想纯粹使用 g++ 构建时,因为我的所有 C 代码都以这种方式包含...

extern "C" {
#include "c_header.h"
}

如何从 atollic/eclipse 中删除 C 编译器?

我尝试删除项目文件“.cproject”中定义的工具,然后再次打开项目,但它们会自动添加。

最佳答案

窗口 -> 首选项 -> C/C++ -> 语言映射 -> 添加

然后添加两个关联:

Content type : C Header file
Language : GNU C++

Content type : C Source file
Language : GNU C++

关于c++ - 嵌入式 C/C++ Atollic,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44285774/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com