我正在尝试编译 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;
在“库配置”下,我选择“普通 DLIB”,我也尝试使用“完整 DLIB”,但 IAR 无法看到 std 库
请问有什么想法吗?
最佳答案
根据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/