ho121
2021-04-07 11:39:28 +08:00
#ifdef darwin
{
char path[1024];
uint32_t size = sizeof(path);
if (_NSGetExecutablePath(path, &size) == 0) {
exePath=string(path);
}
}
#elif defined(__linux__)
{
const int bufSize=1024;
char path[bufSize];
label length=readlink("/proc/self/exe",path,bufSize-1);
path[length]='\0';
exePath=string(path);
}
#else
Not yet implemented;
#endif
意思是,当 darwin 和__linux__都没被定义的情况下,这段代码会被预处理为:Not yet implemented;
于是编译不会通过,这是故意为之。
Clang 报错估计是参数有问题。