在 Borland C++ 中构建 STL 应用程序建造者5.0
我是 Borland C++ builder 5.0 的新手。我使用过小型 STL 应用程序,该应用程序在一台机器(Windows 2003 Server SP2)中编译成功,但在另一台机器(Windows XP 机器 SP3)中编译失败。我已经放置了代码片段和错误消息
Error E2285 Could not find a match for 'distance<>(const AnsiString *,const AnsiString *,i
nt)
我已打开 Borland C++ Form 并在 Form Create 中添加了以下代码
#include <vcl.h>
#pragma hdrstop
#include <vector>
using namespace std;
using std::distance;
static const AnsiString Text_FieldsInTypen[]=
{
"code_segment_national_2"
};
#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormCreate(TObject *Sender)
{
vector<AnsiString> aVec;
aVec.push_back("Test");
const AnsiString* Iter;
int Index = 0;
distance(Text_FieldsInTypen, Iter, Index);
}
//---------------------------------------------------------------------------
I am new to Borland C++ builder 5.0.I have used small STL application which is compiled successfully in one machine(Window 2003 Server SP2), but not in another machine (Windows XP machine SP3). I have placed an code snippet and error message
Error E2285 Could not find a match for 'distance<>(const AnsiString *,const AnsiString *,i
nt)
I have opened Borland C++ Form and added the below code in Form Create
#include <vcl.h>
#pragma hdrstop
#include <vector>
using namespace std;
using std::distance;
static const AnsiString Text_FieldsInTypen[]=
{
"code_segment_national_2"
};
#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormCreate(TObject *Sender)
{
vector<AnsiString> aVec;
aVec.push_back("Test");
const AnsiString* Iter;
int Index = 0;
distance(Text_FieldsInTypen, Iter, Index);
}
//---------------------------------------------------------------------------
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
距离算法需要两个迭代器:
而不是三个不相关的参数。
Iter
也可以在代码中以未初始化的方式使用。The distance algorithm takes two iterators:
Not three unrelated arguments.
Iter
is also used uninitialized in your code.