我正在尝试编译一个我从网上获得的相对简单的应用程序..
运行make时出现以下错误:
In file included from main.cpp:2:0:
os.h: In function ‘void myOpenDir(const char*)’:
os.h:13:16: error: ‘chdir’ was not declared in this scope
os.h文件如下所示:
#ifndef OS_H
#define OS_H
#if defined(__GNUG__)
#define INT64 long long
#define UINT64 unsigned long long
#include <dirent.h>
#define SPRTR '/'
void myOpenDir(const char* dirpath)
{
chdir(dirpath);
}
#elif defined(_MSC_VER)
#define INT64 __int64
#define UINT64 unsigned __int64
#include <direct.h>
#define SPRTR '\\'
void myOpenDir(const char* dirpath)
{
_chdir(dirpath);
}
#else
#error "Platform not supported. Need to update source code"
#endif
#endif
有人知道为什么不编译?
我还通过g ++ - 4.7.real -c main.cpp使用了g ++编译器,但到目前为止还没有运气。