为何报类型错误?好象和vector.h list.h有关?
//gloabalfuntion.h
#ifndef gloabalfuntionH
#define gloabalfuntionH
//---------------------------------
float __fastcall calinterval(String selectedfield);
#endif
//gloabalfuntion.cpp
//---------------------------------
#pragma hdrstop
#include <vector.h>
#include <list.h>
#include "gloabalfuntion.h "
//-----------------------------------
#pragma package(smart_init)
float __fastcall calinterval(String selectedfield)
{
//函数体
}
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >
//Unit1.h
#ifndef Unit1H
#define Unit1H
//--------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
//--------------------------------------------
class TForm1 : public TForm
{
__published:// IDE-managed Components
TButton *Button1;
void __fastcall Button1Click(TObject *Sender);
private:// User declarations
public:// User declarations
__fastcall TForm1(TComponent* Owner);
};
//-------------------------------------
extern PACKAGE TForm1 *Form1;
//--------------------------------------
#endif
//Unit1.cpp
#include <vcl.h>
#pragma hdrstop
#include <vector.h>
#include <list.h>
#include "gloabalfuntion.h "
#include "Unit1.h "
//-----------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm "
TForm1 *Form1;
//-------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//-----------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
list <vector <int> > aa;
String bb= " ";
calgroup(aa,bb);
}
[解决办法]
用了vector和list,出现类型报错,加一条
using namespace std;
就可以
[解决办法]
呵呵,你也不仔细看看帮助,名字空间要加的。
using namespace std;
在.h的定义前面,以及cpp的include后面