c++ - IAR Workbench 找不到 std::string

标签 c++ embedded shared-libraries iar

我正在尝试编译 CppUTest作为 Windows 7 x64 上 AVR UC3C0512C 的 IAR Workbench v6.3.3 上的库,但当我编译它时,它说 std 命名空间未定义。

这是我遇到第一个错误的代码片段,文件是 SimpleString.h:

#if CPPUTEST_USE_STD_CPP_LIB
  #include <string>
  #include <stdint.h>

  SimpleString StringFrom(const std::string& other);

最后一行包含 std::string 这给我带来了 190 个与此相关的错误。消息是:

Error[Pe276]: name followed by "::" must be a class or namespace name
C:\COM\SRC\cpputest35\include\CppUTest\SimpleString.h 143 

我尝试使用下面的行,但没有帮助:

using namespace std;

enter image description here

在“库配置”下,我选择“普通 DLIB”,我也尝试使用“完整 DLIB”,但 IAR 无法看到 std 库

enter image description here

请问有什么想法吗?

最佳答案

根据IAR手册

The std namespace is not used in either standard EC++ or in Extended EC++. If you 
have code that refers to symbols in the std namespace, simply define std as nothing; 
for example:
#define std // Nothing here

关于c++ - IAR Workbench 找不到 std::string,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19652366/

相关文章:

c++ - 将键移出 std::map<> &&

c++ - 未定义的行为错误 : Changes to a member variable visible only from some contexts

python - PyUnicode_AsUTF8() 段错误

c++ - 链接库未在 makefile 中正确设置

c++ - 将参数传递给自动转换为指针的函数

c++ - 为什么没有 boost::container::queue ?

c - C语言中全局变量和局部变量都存储在内存中

Angular 6私有(private)方法

linux - 如何使用应用程序部署 Qt 库?

c++ - 如何在没有运行时成本的情况下基于断言指导 GCC 优化?