HewlettPackard / quartz

Quartz: A DRAM-based performance emulator for NVM
https://github.com/HewlettPackard/quartz
Other
159 stars 66 forks source link

Run wtih C++ program and complie return errors: #36

Open ParkWANG opened 5 years ago

ParkWANG commented 5 years ago

I run Quartz with my own CPP file, with the command: g++ -I [Eumlator_Path]/quartz/src/lib/ myprogram.cpp -L [Eumlator_Path]/quartz/build/src/lib/ -lnvmemul, (it works well with .C file with gcc complier) But turns error: /usr/include/c++/6/ext/string_conversions.h: In constructor ‘gnu_cxx::__stoa(_TRet ()(const _CharT, _CharT*, _Base ...), const char, const _CharT, std::size_t, _Base ...)::_Save_errno::_Save_errno()’: /usr/include/c++/6/ext/string_conversions.h:63:27: error: ‘errno’ was not declared in this scope _Save_errno() : _M_errno(errno) { errno = 0; } ^ /usr/include/c++/6/ext/string_conversions.h: In destructor ‘gnu_cxx::stoa(_TRet ()(const _CharT, _CharT*, _Base ...), const char, const _CharT, std::size_t, _Base ...)::_Save_errno::~_Save_errno()’: /usr/include/c++/6/ext/string_conversions.h:64:23: error: ‘errno’ was not declared in this scope ~_Save_errno() { if (errno == 0) errno = _M_errno; } ^ /usr/include/c++/6/ext/string_conversions.h: In function ‘_Ret gnu_cxx::__stoa(_TRet ()(const _CharT, _CharT*, _Base ...), const char, const _CharT, std::size_t, _Base ...)’: /usr/include/c++/6/ext/string_conversions.h:72:16: error: ‘errno’ was not declared in this scope else if (errno == ERANGE ^ In file included from /usr/include/c++/6/bits/basic_string.h:5420:0, from /usr/include/c++/6/string:52, from /usr/include/c++/6/bits/locale_classes.h:40, from /usr/include/c++/6/bits/ios_base.h:41, from /usr/include/c++/6/ios:42, from /usr/include/c++/6/ostream:38, from /usr/include/c++/6/iostream:39, from /home/lishuai/fwang/quartz/reram_test.cpp:2: /usr/include/c++/6/ext/string_conversions.h:72:25: error: ‘ERANGE’ was not declared in this scope else if (errno == ERANGE

The primal error has a lot "XXX" was not declared in this scope, and I have already fixed some. But for the left, I need help.
Have somebody met the same problem or give some suggestions? Thank you.

iBalance94 commented 5 years ago

Have you solved the problem? I met this problem at present./(ㄒoㄒ)/~~

ParkWANG commented 5 years ago

Have you solved the problem? I met this problem at present./(ㄒoㄒ)/~~

Yes. You can go to /usr/include/c++/6/ext/string_conversions.h and add the declaration of "ERANGE". Or, you can comment the sentence (since I noticed error mention it is not important, but of course, this is not a good solution. you can try).

iBalance94 commented 5 years ago

Okay, thanks.