模糊符号字符串

时间:2013-04-30 18:36:03

标签: c++-cli

我正在用c ++ / cli编写一个程序,它给了我错误: 错误C2872:'字符串':模糊符号

我使用String作为函数的一部分: Dictionary<String^, List<array< Byte >^>^>^ FalseTrigg(Dictionary<String^, String^>^ imgParms, bool windowOn)

以下是整体计划。谢谢你的帮助。

 #include <errno.h>
 #include <vector>
 #include <string>
 #include <iostream>
 #include <sstream>
 #include <string>
 #include <fstream>

 #pragma managed(push, off)

 #include "cv.h" 
 #include "highgui.h" 
 #include <stdio.h>
 #include "opencv2/core/core.hpp"
 #include "opencv2/features2d/features2d.hpp"
 #include "opencv2/highgui/highgui.hpp"
 #include "opencv2/nonfree/nonfree.hpp"
 #include <opencv2/nonfree/features2d.hpp>

 #pragma managed(pop)

 using namespace cv;
 using namespace std;
 using namespace System;
 using namespace System::Collections::Generic;
 using namespace System::Runtime::InteropServices;


 public ref class FalseTrig
{
  public:
  FalseTrig() { } 
  ~FalseTrig() { } 

  Dictionary<String^, List<array< Byte >^>^>^ FalseTrigg(Dictionary<String^, String^>^ imgParms, bool windowOn) 
  {}
};

2 个答案:

答案 0 :(得分:2)

你有两个String类定义,编译器不知道你需要哪一个。错误消息应该有更多行,它将列出它找到的各种“字符串”类。

我不确定它找到了哪些定义,因为std::string应该是小写的“s”,而你使用的是大写的“S”。

在您的方法定义中,只需将String^替换为System::String^,您就应该做得很好。

或者,您可以找出它找到的“字符串”类,并将您的using namespace指令更改为不使用包含其他字符串类的命名空间。您还可以使用typedef使String明确引用System::String

答案 1 :(得分:-1)

看起来你已经为String包含了两次定义。

#include <errno.h>
#include <vector>
#include <string>  //-> First time
#include <iostream>
#include <sstream>
#include <string>  //-> Second time
#include <fstream>
相关问题