2

我正在尝试将 CppUTest 编译IAR Workbench v6.3.3 上的库,用于 Windows 7 x64 上的 AVR UC3C0512C,但是当我编译它时,它说 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 看不到标准库

在此处输入图像描述

请问有什么想法吗?

4

1 回答 1

4

根据 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
于 2013-10-29T08:21:13.780 回答