C++ cli 不明确的符号字符串
我正在用c++/cli编写一个程序,它给了我一个错误: 错误C2872:“字符串”:符号不明确 我使用字符串作为函数的一部分:C++ cli 不明确的符号字符串,c++-cli,C++ Cli,我正在用c++/cli编写一个程序,它给了我一个错误: 错误C2872:“字符串”:符号不明确 我使用字符串作为函数的一部分: Dictionary^>^FalseTrigg(Dictionary^imgParms,bool windowOn) 以下是总体方案。谢谢你的帮助 #include <errno.h> #include <vector> #include <string> #include <iostream> #include
Dictionary^>^FalseTrigg(Dictionary^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)
{}
};
#包括
#包括
#包括
#包括
#包括
#包括
#包括
#pragma管理(推、关)
#包括“cv.h”
#包括“highgui.h”
#包括
#包括“opencv2/core/core.hpp”
#包括“opencv2/features2d/features2d.hpp”
#包括“opencv2/highgui/highgui.hpp”
#包括“opencv2/nonfree/nonfree.hpp”
#包括
#布拉格语管理(pop)
使用名称空间cv;
使用名称空间std;
使用名称空间系统;
使用命名空间System::Collections::Generic;
使用名称空间System::Runtime::InteropServices;
公共引用类FalseTrig
{
公众:
FalseTrig(){}
~FalseTrig(){}
字典^FalseTrigg(字典^imgParms,bool windowOn)
{}
};
看起来您已经两次包含了字符串的定义
#include <errno.h>
#include <vector>
#include <string> //-> First time
#include <iostream>
#include <sstream>
#include <string> //-> Second time
#include <fstream>
#包括
#包括
#包括//->第一次
#包括
#包括
#包括//->第二次
#包括
类字符串有两个定义,编译器不知道需要哪一个。错误消息应该有更多的行,它将列出它找到的各种“字符串”类
我不确定它找到了哪些定义,因为std::string
应该是小写的“s”,而您使用的是大写的“s”
在您的方法定义中,只需将String^
替换为System::String^
,就可以了
或者,您可以找出它正在查找哪些“string”类,并将using namespace
指令更改为不使用包含其他string类的名称空间。您还可以使用typedef使字符串
显式引用系统::字符串
头文件具有适当的包含保护。包括两次不会有任何伤害。