有C++ BUILDER高手在吗?帮我看下这个奇怪的错误信息,谢谢
有C++ BUILDER高手在吗?帮我看下奇怪的问题,谢谢!
我有个主程序,Main.cpp ,运行正常,没有问题,后来,我准备在工程里加个线程如myThread.cpp,搞成多线程的,但是我的线程文件里,只要它的头文件里加入#include "Main.h"这一行,程序就报错,拿掉这一行就行了,奇怪,找不到原因:
如下为线程的头文件
myThread.h
#ifndef WriteExcelThreadH
#define WriteExcelThreadH
//---------------------------------------
#include <Classes.hpp>
#include<Comobj.hpp>
#include<Utilcls.h>
#include "Main.h" //加入这行就报错,报错的居然是说我Main.h中声明的函数有问题,如下
#include "define.h"
//---------------------------------------
class TWriteExcelData : public TThread
{
private:
protected:
void __fastcall Execute();
public:
__fastcall TWriteExcelData(bool CreateSuspended);
};
//---------------------------------------
#endif
//-------------------------------
Main.h
private:// User declarations
public:// User declarations
void __fastcall FillData(int iStyle,int iCounts,int iSheetsCount,Variant ewb,Variant ews,std::vector <SourceInfo> sInfo);
void __fastcall ReadData(int iCounts,std::vector <SourceInfo> &sInfo);
//报错说
Build
[C++ Warning] Main.cpp(5): W8058 Cannot create pre-compiled header: write failed
[C++ Warning] Main.cpp(99): W8004 'inum' is assigned a value that is never used
[C++ Warning] WriteExcelThread.cpp(4): W8058 Cannot create pre-compiled header: write failed
[C++ Error] Main.h(61): E2316 'vector' is not a member of 'std'
[C++ Error] Main.h(61): E2293 ) expected
[C++ Error] Main.h(62): E2316 'vector' is not a member of 'std'
[C++ Error] Main.h(62): E2293 ) expected
找不到原因,能帮看下吗?谢谢,看错误好像是少了括号 ,为什么只要一拿掉#include "Main.h"就没问题,
[解决办法]
头文件加上 #include <vector>