我正在尝试使用Fedora 24上的GCC构建VBA-M,但是我收到了这个错误:
[ 69%] Building CXX object CMakeFiles/vbam.dir/src/sdl/expr.cpp.o
In file included from /usr/include/c++/6.1.1/stdlib.h:36:0,
from expr.ypp:5:
/usr/include/c++/6.1.1/cstdlib:124:11: error: ‘::div_t’ has not been declared
using ::div_t;
^~~~~
/usr/include/c++/6.1.1/cstdlib:125:11: error: ‘::ldiv_t’ has not been declared
using ::ldiv_t;
^~~~~~
/usr/include/c++/6.1.1/cstdlib:127:11: error: ‘::abort’ has not been declared
using ::abort;
^~~~~
/usr/include/c++/6.1.1/cstdlib:128:11: error: ‘::abs’ has not been declared
using ::abs;
^~~
/usr/include/c++/6.1.1/cstdlib:129:11: error: ‘::atexit’ has not been declared
using ::atexit;
^~~~~~
/usr/include/c++/6.1.1/cstdlib:132:11: error: ‘::at_quick_exit’ has not been declared
using ::at_quick_exit;
^~~~~~~~~~~~~
/usr/include/c++/6.1.1/cstdlib:135:11: error: ‘::atof’ has not been declared
using ::atof;
^~~~
/usr/include/c++/6.1.1/cstdlib:136:11: error: ‘::atoi’ has not been declared
using ::atoi;
^~~~
/usr/include/c++/6.1.1/cstdlib:137:11: error: ‘::atol’ has not been declared
using ::atol;
^~~~
/usr/include/c++/6.1.1/cstdlib:138:11: error: ‘::bsearch’ has not been declared
using ::bsearch;
^~~~~~~
/usr/include/c++/6.1.1/cstdlib:139:11: error: ‘::calloc’ has not been declared
using ::calloc;
^~~~~~
/usr/include/c++/6.1.1/cstdlib:140:11: error: ‘::div’ has not been declared
using ::div;
^~~
/usr/include/c++/6.1.1/cstdlib:141:11: error: ‘::exit’ has not been declared
using ::exit;
^~~~
/usr/include/c++/6.1.1/cstdlib:142:11: error: ‘::free’ has not been declared
using ::free;
^~~~
/usr/include/c++/6.1.1/cstdlib:143:11: error: ‘::getenv’ has not been declared
using ::getenv;
^~~~~~
/usr/include/c++/6.1.1/cstdlib:144:11: error: ‘::labs’ has not been declared
using ::labs;
^~~~
/usr/include/c++/6.1.1/cstdlib:145:11: error: ‘::ldiv’ has not been declared
using ::ldiv;
^~~~
/usr/include/c++/6.1.1/cstdlib:146:11: error: ‘::malloc’ has not been declared
using ::malloc;
^~~~~~
/usr/include/c++/6.1.1/cstdlib:148:11: error: ‘::mblen’ has not been declared
using ::mblen;
^~~~~
/usr/include/c++/6.1.1/cstdlib:149:11: error: ‘::mbstowcs’ has not been declared
using ::mbstowcs;
^~~~~~~~
/usr/include/c++/6.1.1/cstdlib:150:11: error: ‘::mbtowc’ has not been declared
using ::mbtowc;
^~~~~~
/usr/include/c++/6.1.1/cstdlib:152:11: error: ‘::qsort’ has not been declared
using ::qsort;
^~~~~
/usr/include/c++/6.1.1/cstdlib:155:11: error: ‘::quick_exit’ has not been declared
using ::quick_exit;
^~~~~~~~~~
/usr/include/c++/6.1.1/cstdlib:158:11: error: ‘::rand’ has not been declared
using ::rand;
^~~~
/usr/include/c++/6.1.1/cstdlib:159:11: error: ‘::realloc’ has not been declared
using ::realloc;
^~~~~~~
/usr/include/c++/6.1.1/cstdlib:160:11: error: ‘::srand’ has not been declared
using ::srand;
^~~~~
/usr/include/c++/6.1.1/cstdlib:161:11: error: ‘::strtod’ has not been declared
using ::strtod;
^~~~~~
/usr/include/c++/6.1.1/cstdlib:162:11: error: ‘::strtol’ has not been declared
using ::strtol;
^~~~~~
/usr/include/c++/6.1.1/cstdlib:163:11: error: ‘::strtoul’ has not been declared
using ::strtoul;
^~~~~~~
/usr/include/c++/6.1.1/cstdlib:164:11: error: ‘::system’ has not been declared
using ::system;
^~~~~~
/usr/include/c++/6.1.1/cstdlib:166:11: error: ‘::wcstombs’ has not been declared
using ::wcstombs;
^~~~~~~~
/usr/include/c++/6.1.1/cstdlib:167:11: error: ‘::wctomb’ has not been declared
using ::wctomb;
^~~~~~
/usr/include/c++/6.1.1/cstdlib:220:11: error: ‘::lldiv_t’ has not been declared
using ::lldiv_t;
^~~~~~~
/usr/include/c++/6.1.1/cstdlib:226:11: error: ‘::_Exit’ has not been declared
using ::_Exit;
^~~~~
/usr/include/c++/6.1.1/cstdlib:230:11: error: ‘::llabs’ has not been declared
using ::llabs;
^~~~~
/usr/include/c++/6.1.1/cstdlib:236:11: error: ‘::lldiv’ has not been declared
using ::lldiv;
^~~~~
/usr/include/c++/6.1.1/cstdlib:247:11: error: ‘::atoll’ has not been declared
using ::atoll;
^~~~~
/usr/include/c++/6.1.1/cstdlib:248:11: error: ‘::strtoll’ has not been declared
using ::strtoll;
^~~~~~~
/usr/include/c++/6.1.1/cstdlib:249:11: error: ‘::strtoull’ has not been declared
using ::strtoull;
^~~~~~~~
/usr/include/c++/6.1.1/cstdlib:251:11: error: ‘::strtof’ has not been declared
using ::strtof;
^~~~~~
/usr/include/c++/6.1.1/cstdlib:252:11: error: ‘::strtold’ has not been declared
using ::strtold;
^~~~~~~
/usr/include/c++/6.1.1/cstdlib:260:11: error: ‘::__gnu_cxx’ has not been declared
using ::__gnu_cxx::lldiv_t;
^~~~~~~~~
/usr/include/c++/6.1.1/cstdlib:262:11: error: ‘::__gnu_cxx’ has not been declared
using ::__gnu_cxx::_Exit;
^~~~~~~~~
/usr/include/c++/6.1.1/cstdlib:264:11: error: ‘::__gnu_cxx’ has not been declared
using ::__gnu_cxx::llabs;
^~~~~~~~~
/usr/include/c++/6.1.1/cstdlib:265:11: error: ‘::__gnu_cxx’ has not been declared
using ::__gnu_cxx::div;
^~~~~~~~~
/usr/include/c++/6.1.1/cstdlib:266:11: error: ‘::__gnu_cxx’ has not been declared
using ::__gnu_cxx::lldiv;
^~~~~~~~~
/usr/include/c++/6.1.1/cstdlib:268:11: error: ‘::__gnu_cxx’ has not been declared
using ::__gnu_cxx::atoll;
^~~~~~~~~
/usr/include/c++/6.1.1/cstdlib:269:11: error: ‘::__gnu_cxx’ has not been declared
using ::__gnu_cxx::strtof;
^~~~~~~~~
/usr/include/c++/6.1.1/cstdlib:270:11: error: ‘::__gnu_cxx’ has not been declared
using ::__gnu_cxx::strtoll;
^~~~~~~~~
/usr/include/c++/6.1.1/cstdlib:271:11: error: ‘::__gnu_cxx’ has not been declared
using ::__gnu_cxx::strtoull;
^~~~~~~~~
/usr/include/c++/6.1.1/cstdlib:272:11: error: ‘::__gnu_cxx’ has not been declared
using ::__gnu_cxx::strtold;
^~~~~~~~~
In file included from expr.ypp:5:0:
/usr/include/c++/6.1.1/stdlib.h:38:12: error: ‘std::std::abort’ has not been declared
using std::abort;
^~~~~
/usr/include/c++/6.1.1/stdlib.h:39:12: error: ‘std::std::atexit’ has not been declared
using std::atexit;
^~~~~~
/usr/include/c++/6.1.1/stdlib.h:40:12: error: ‘std::std::exit’ has not been declared
using std::exit;
^~~~
/usr/include/c++/6.1.1/stdlib.h:43:14: error: ‘std::std::at_quick_exit’ has not been declared
using std::at_quick_exit;
^~~~~~~~~~~~~
/usr/include/c++/6.1.1/stdlib.h:46:14: error: ‘std::std::quick_exit’ has not been declared
using std::quick_exit;
^~~~~~~~~~
/usr/include/c++/6.1.1/stdlib.h:51:12: error: ‘std::std::div_t’ has not been declared
using std::div_t;
^~~~~
/usr/include/c++/6.1.1/stdlib.h:52:12: error: ‘std::std::ldiv_t’ has not been declared
using std::ldiv_t;
^~~~~~
/usr/include/c++/6.1.1/stdlib.h:55:12: error: ‘std::std::atof’ has not been declared
using std::atof;
^~~~
/usr/include/c++/6.1.1/stdlib.h:56:12: error: ‘std::std::atoi’ has not been declared
using std::atoi;
^~~~
/usr/include/c++/6.1.1/stdlib.h:57:12: error: ‘std::std::atol’ has not been declared
using std::atol;
^~~~
/usr/include/c++/6.1.1/stdlib.h:58:12: error: ‘std::std::bsearch’ has not been declared
using std::bsearch;
^~~~~~~
/usr/include/c++/6.1.1/stdlib.h:59:12: error: ‘std::std::calloc’ has not been declared
using std::calloc;
^~~~~~
/usr/include/c++/6.1.1/stdlib.h:61:12: error: ‘std::std::free’ has not been declared
using std::free;
^~~~
/usr/include/c++/6.1.1/stdlib.h:62:12: error: ‘std::std::getenv’ has not been declared
using std::getenv;
^~~~~~
/usr/include/c++/6.1.1/stdlib.h:63:12: error: ‘std::std::labs’ has not been declared
using std::labs;
^~~~
/usr/include/c++/6.1.1/stdlib.h:64:12: error: ‘std::std::ldiv’ has not been declared
using std::ldiv;
^~~~
/usr/include/c++/6.1.1/stdlib.h:65:12: error: ‘std::std::malloc’ has not been declared
using std::malloc;
^~~~~~
/usr/include/c++/6.1.1/stdlib.h:67:12: error: ‘std::std::mblen’ has not been declared
using std::mblen;
^~~~~
/usr/include/c++/6.1.1/stdlib.h:68:12: error: ‘std::std::mbstowcs’ has not been declared
using std::mbstowcs;
^~~~~~~~
/usr/include/c++/6.1.1/stdlib.h:69:12: error: ‘std::std::mbtowc’ has not been declared
using std::mbtowc;
^~~~~~
/usr/include/c++/6.1.1/stdlib.h:71:12: error: ‘std::std::qsort’ has not been declared
using std::qsort;
^~~~~
/usr/include/c++/6.1.1/stdlib.h:72:12: error: ‘std::std::rand’ has not been declared
using std::rand;
^~~~
/usr/include/c++/6.1.1/stdlib.h:73:12: error: ‘std::std::realloc’ has not been declared
using std::realloc;
^~~~~~~
/usr/include/c++/6.1.1/stdlib.h:74:12: error: ‘std::std::srand’ has not been declared
using std::srand;
^~~~~
/usr/include/c++/6.1.1/stdlib.h:75:12: error: ‘std::std::strtod’ has not been declared
using std::strtod;
^~~~~~
/usr/include/c++/6.1.1/stdlib.h:76:12: error: ‘std::std::strtol’ has not been declared
using std::strtol;
^~~~~~
/usr/include/c++/6.1.1/stdlib.h:77:12: error: ‘std::std::strtoul’ has not been declared
using std::strtoul;
^~~~~~~
/usr/include/c++/6.1.1/stdlib.h:78:12: error: ‘std::std::system’ has not been declared
using std::system;
^~~~~~
/usr/include/c++/6.1.1/stdlib.h:80:12: error: ‘std::std::wcstombs’ has not been declared
using std::wcstombs;
^~~~~~~~
/usr/include/c++/6.1.1/stdlib.h:81:12: error: ‘std::std::wctomb’ has not been declared
using std::wctomb;
我尝试了export CXX=clang++; export CC=clang
,但这给了我不同的错误。
我正在编译的代码中的错误,还是标准库中的错误?我需要安装一个软件包,还是以任何方式解决这个问题?我应该直接编辑包含文件吗?
答案 0 :(得分:3)
在Arch Linux上构建时遇到了同样的问题。问题是expr.cpp
文件包含命名空间内的内容。如果您同时查看expr.ypp
和expr.cpp
,您会看到以下内容:
namespace std {
#include <memory.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
}
问题是包含在命名空间内。我改为现在,它现在有效:
#include <memory.h>
#include <stdio.h>
#include <cstdlib>
#include <string.h>
希望它有所帮助!