读书人

linux下奇怪的编译异常!高分请问

发布时间: 2012-02-19 19:43:39 作者: rapoo

linux下奇怪的编译错误!高分请教!
程序代码:
#ifndef _INPUTBUFFER_H
#define _INPUTBUFFER_H
using namespace std;
namespace Linden {

class InputBuffer
{
public:
InputBuffer(char* ,size_t );
InputBuffer(size_t = 0);
virtual ~InputBuffer(void);

///读数据
void read(char* , size_t);

///读一个byte
byte_t readByte();

///读bytes
void readBytes(byte_t*, size_t, size_t );

///读int32_t
int32_t readInt();

///读变长整型数
int32_t readVInt();

///读int64_t
int64_t readLong();

///读长整形变长整数
int64_t readVLong();

///读字符串
void readString(string& s);

void readCChars(char* ch)
{
int size = readVInt();
readChars(ch, 0, (size_t)size);
}

///读字符
void readChars(char* buffer, size_t start, size_t length);

///跳过一个变长整型数
void skipVInt(size_t nNum);

///tellg
int64_t tellg();

///seek
void seek(int64_t pos);

///判断文件是否结束
booleof();

///求文件长度
int64_t length()const;

///设置文件长度
voidsetLength(int64_t newLen);

///设置缓冲
voidsetBuffer(char* buf,size_t bufSize);

///内部读
virtual voidreadInternal(char* b, size_t offset, size_t length) = 0;

///关闭文件


virtual InputBuffer* clone() = 0;
virtual voidclose() = 0;
virtual string filename() = 0;
size_t getBuffer()
{
return _bufferSize;
}
protected:
///重新读满缓冲
voidrefill();

virtual voidseekInternal(int64_t pos) = 0;

char* _buffer;
size_t _bufferSize;
int64_t _bufferStart;
size_t _bufferLength;
size_t _bufferPosition;

int64_t _length; //文件指针的位置,一般为指向文件的末尾
bool _bOwnBuff;
//set friend inputer?
///friend class OutputBuffer;


} ;
//这块就是上面函数的实现了。
}
#endif

错误提示:
InputBuffer.h:3: 错误:expected unqualified-id before ‘using’
/usr/lib/gcc/i386-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_tree.h:397: 错误:‘__is_pod’ 不是 ‘Linden::std’ 的成员
/usr/lib/gcc/i386-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_tree.h:397: 错误:expected primary-expression before ‘> ’ token
/usr/lib/gcc/i386-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_tree.h:397: 错误:expected constructor, destructor, or type conversion before ‘> ’ token
/usr/lib/gcc/i386-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_tree

。。。。。。
这个程序的代码肯定没有问题,我以前的使用过,完全没有错误。我在windows的 .net下,写的程序(windows没调试),写完放到linux下,编译的时候就出现了这个错误!我实在无法解决,请高手指教!

[解决办法]
头文件问题。stl_tree.h
[解决办法]
Makefile怎么写的, 用g++了没

windows和linux的编译环境不同,C库不同,编译错误很正常,

读书人网 >UNIXLINUX

热点推荐