Related
Every time I make a new project in Eclipse Oxygen CDT, I'm always plagued by three main errors: "Type 'std::string' could not be resolved" (or similar inclusion problems), "Launch failed. Binaries not found," and "Launch failed. Program file does not exist".
I feel like I have tried just about everything. I have researched and followed these questions: Eclipse C++: Symbol 'std' could not be resolved
, The program file specified in the launch configuration does not exist, Launch Failed Binary not found Eclipse for C in Windows
, Eclipse CDT project built but “Launch Failed. Binary Not Found”
, “string could not resolved” error in Eclipse for C++ (Eclipse can't resolve standard library)
, C++ - Unresolved inclusion: iostream
, Eclipse c++ Type could not be resolved error even though build is successful
, and How to include a file from another folder?
.
Hi World Example:
/*
* Hi_world.cpp
*
* Created on: Feb 22, 2018
* Author: Me
*/
//I tried using the actual file paths but that didn't help either
#include <C:\MinGW\lib\gcc\mingw32\5.3.0\include\c++\iostream>
#include <C:\MinGW\include\string.h>
using namespace std;//"Symbol 'std' could not be resolved"
int main()
{
std::string me = "hi world";//"Type 'std::string' could not be resolved"
std::cout << me << std::endl;//"Symbol 'cout' could not be resolved"
// and "Symbol 'endl' could not be resolved"
}
Note: I tried to get this to run for several hours one day, was unsuccessful, so I saved and exited eclipse and my computer. The next day I turned on my computer, cleaned, built, and ran my this program as is, and it ran corectly on first try (although the red squiggly lines didn't disappear).
Hear is this Programs build log:
12:37:15 **** Rebuild of configuration Debug for project Hi world ****
Info: Internal Builder is used for build
g++ -O0 -g3 -Wall -c -fmessage-length=0 -o Hi_world.o "..\\Hi_world.cpp"
g++ "-LC:\\MinGW" -o "Hi world.exe" Hi_world.o
12:37:17 Build Finished (took 1s.47ms)
Hear is another example that still doesn't Run:
#include <iostream>
#include "stdio.h"
#include "time.h"
#include "string.h"
int main ()
{
time_t timer;
struct tm y2k = {0};
double seconds;
y2k.tm_hour = 0; y2k.tm_min = 0; y2k.tm_sec = 0;
y2k.tm_year = 100; y2k.tm_mon = 0; y2k.tm_mday = 1;
time(&timer); /* get current time; same as: timer = time(NULL) */
seconds = difftime(timer,mktime(&y2k));
printf ("%.f seconds since January 1, 2000 in the current timezone", seconds);
return 0;
}
Note: This had all the inclusion errors mentioned before, but randomly between a clean and rebuild those red squiggly errors went away. However it still doesn't build and run correctly with the error message "Launch failed. Binary not found."
Hear is this programs build log:
12:40:10 **** Rebuild of configuration Debug for project Time ****
Info: Internal Builder is used for build
g++ "-IC:\\MinGW\\lib\\gcc\\mingw32\\5.3.0\\include\\c++\\debug" -O0 -g3 -Wall -c -fmessage-length=0 -o Time.o "..\\Time.cpp"
In file included from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\basic_ios.h:37:0,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ios:44,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ostream:38,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\iostream:39,
from ..\Time.cpp:8:
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\locale_facets.h: In member function 'std::__cxx11::string std::__cxx11::numpunct<_CharT>::grouping() const':
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\locale_facets.h:1777:7: error: return type 'std::__cxx11::string {aka class std::__cxx11::basic_string<char>}' is incomplete
{ return this->do_grouping(); }
^
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\locale_facets.h: In member function 'virtual std::__cxx11::string std::__cxx11::numpunct<_CharT>::do_grouping() const':
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\locale_facets.h:1845:7: error: return type 'std::__cxx11::string {aka class std::__cxx11::basic_string<char>}' is incomplete
{ return _M_data->_M_grouping; }
^
In file included from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\locale_facets.h:2651:0,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\basic_ios.h:37,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ios:44,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ostream:38,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\iostream:39,
from ..\Time.cpp:8:
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\locale_facets.tcc: In member function 'void std::__numpunct_cache<_CharT>::_M_cache(const std::locale&)':
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\locale_facets.tcc:88:26: error: invalid use of incomplete type 'const string {aka const class std::__cxx11::basic_string<char>}'
_M_grouping_size = __g.size();
^
In file included from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\iosfwd:39:0,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ios:38,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ostream:38,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\iostream:39,
from ..\Time.cpp:8:
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\stringfwd.h:71:11: note: declaration of 'std::__cxx11::string {aka class std::__cxx11::basic_string<char>}'
class basic_string;
^
In file included from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\locale_facets.h:2651:0,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\basic_ios.h:37,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ios:44,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ostream:38,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\iostream:39,
from ..\Time.cpp:8:
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\locale_facets.tcc:90:7: error: invalid use of incomplete type 'const string {aka const class std::__cxx11::basic_string<char>}'
__g.copy(__grouping, _M_grouping_size);
^
In file included from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\iosfwd:39:0,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ios:38,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ostream:38,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\iostream:39,
from ..\Time.cpp:8:
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\stringfwd.h:71:11: note: declaration of 'std::__cxx11::string {aka class std::__cxx11::basic_string<char>}'
class basic_string;
^
In file included from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\locale_facets.h:2651:0,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\basic_ios.h:37,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ios:44,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ostream:38,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\iostream:39,
from ..\Time.cpp:8:
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\locale_facets.tcc: In member function '_InIter std::num_get<_CharT, _InIter>::_M_extract_float(_InIter, _InIter, std::ios_base&, std::ios_base::iostate&, std::__cxx11::string&) const':
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\locale_facets.tcc:211:18: error: invalid use of incomplete type 'std::__cxx11::string {aka class std::__cxx11::basic_string<char>}'
__found_grouping.reserve(32);
^
In file included from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\iosfwd:39:0,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ios:38,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ostream:38,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\iostream:39,
from ..\Time.cpp:8:
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\stringfwd.h:71:11: note: declaration of 'std::__cxx11::string {aka class std::__cxx11::basic_string<char>}'
class basic_string;
^
In file included from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\locale_facets.h:2651:0,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\basic_ios.h:37,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ios:44,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ostream:38,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\iostream:39,
from ..\Time.cpp:8:
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\locale_facets.tcc:282:10: error: invalid use of incomplete type 'std::__cxx11::string {aka class std::__cxx11::basic_string<char>}'
__xtrc.clear();
^
In file included from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\iosfwd:39:0,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ios:38,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ostream:38,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\iostream:39,
from ..\Time.cpp:8:
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\stringfwd.h:71:11: note: declaration of 'std::__cxx11::string {aka class std::__cxx11::basic_string<char>}'
class basic_string;
^
In file included from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\locale_facets.h:2651:0,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\basic_ios.h:37,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ios:44,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ostream:38,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\iostream:39,
from ..\Time.cpp:8:
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\locale_facets.tcc:296:27: error: invalid use of incomplete type 'std::__cxx11::string {aka class std::__cxx11::basic_string<char>}'
if (__found_grouping.size())
^
In file included from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\iosfwd:39:0,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ios:38,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ostream:38,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\iostream:39,
from ..\Time.cpp:8:
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\stringfwd.h:71:11: note: declaration of 'std::__cxx11::string {aka class std::__cxx11::basic_string<char>}'
class basic_string;
^
In file included from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\locale_facets.h:2651:0,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\basic_ios.h:37,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ios:44,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ostream:38,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\iostream:39,
from ..\Time.cpp:8:
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\locale_facets.tcc:319:27: error: invalid use of incomplete type 'std::__cxx11::string {aka class std::__cxx11::basic_string<char>}'
if (__found_grouping.size() && !__found_dec)
^
In file included from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\iosfwd:39:0,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ios:38,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ostream:38,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\iostream:39,
from ..\Time.cpp:8:
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\stringfwd.h:71:11: note: declaration of 'std::__cxx11::string {aka class std::__cxx11::basic_string<char>}'
class basic_string;
^
In file included from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\locale_facets.h:2651:0,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\basic_ios.h:37,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ios:44,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ostream:38,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\iostream:39,
from ..\Time.cpp:8:
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\locale_facets.tcc:355:27: error: invalid use of incomplete type 'std::__cxx11::string {aka class std::__cxx11::basic_string<char>}'
if (__found_grouping.size())
^
In file included from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\iosfwd:39:0,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ios:38,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ostream:38,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\iostream:39,
from ..\Time.cpp:8:
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\stringfwd.h:71:11: note: declaration of 'std::__cxx11::string {aka class std::__cxx11::basic_string<char>}'
class basic_string;
^
In file included from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\locale_facets.h:2651:0,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\basic_ios.h:37,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ios:44,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ostream:38,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\iostream:39,
from ..\Time.cpp:8:
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\locale_facets.tcc: In member function '_InIter std::num_get<_CharT, _InIter>::_M_extract_int(_InIter, _InIter, std::ios_base&, std::ios_base::iostate&, _ValueT&) const':
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\locale_facets.tcc:468:20: error: invalid use of incomplete type 'std::__cxx11::string {aka class std::__cxx11::basic_string<char>}'
__found_grouping.reserve(32);
^
In file included from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\iosfwd:39:0,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ios:38,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ostream:38,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\iostream:39,
from ..\Time.cpp:8:
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\stringfwd.h:71:11: note: declaration of 'std::__cxx11::string {aka class std::__cxx11::basic_string<char>}'
class basic_string;
^
In file included from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\locale_facets.h:2651:0,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\basic_ios.h:37,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ios:44,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ostream:38,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\iostream:39,
from ..\Time.cpp:8:
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\locale_facets.tcc:554:22: error: invalid use of incomplete type 'std::__cxx11::string {aka class std::__cxx11::basic_string<char>}'
if (__found_grouping.size())
^
In file included from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\iosfwd:39:0,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ios:38,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ostream:38,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\iostream:39,
from ..\Time.cpp:8:
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\stringfwd.h:71:11: note: declaration of 'std::__cxx11::string {aka class std::__cxx11::basic_string<char>}'
class basic_string;
^
In file included from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\locale_facets.h:2651:0,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\basic_ios.h:37,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ios:44,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ostream:38,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\iostream:39,
from ..\Time.cpp:8:
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\locale_facets.tcc:567:55: error: invalid use of incomplete type 'std::__cxx11::string {aka class std::__cxx11::basic_string<char>}'
if ((!__sep_pos && !__found_zero && !__found_grouping.size())
^
In file included from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\iosfwd:39:0,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ios:38,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ostream:38,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\iostream:39,
from ..\Time.cpp:8:
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\stringfwd.h:71:11: note: declaration of 'std::__cxx11::string {aka class std::__cxx11::basic_string<char>}'
class basic_string;
^
In file included from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\locale_facets.h:2651:0,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\basic_ios.h:37,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ios:44,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ostream:38,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\iostream:39,
from ..\Time.cpp:8:
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\locale_facets.tcc: In member function 'virtual _InIter std::num_get<_CharT, _InIter>::do_get(std::num_get<_CharT, _InIter>::iter_type, std::num_get<_CharT, _InIter>::iter_type, std::ios_base&, std::ios_base::iostate&, float&) const':
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\locale_facets.tcc:695:13: error: invalid use of incomplete type 'std::__cxx11::string {aka class std::__cxx11::basic_string<char>}'
__xtrc.reserve(32);
^
In file included from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\iosfwd:39:0,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ios:38,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ostream:38,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\iostream:39,
from ..\Time.cpp:8:
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\stringfwd.h:71:11: note: declaration of 'std::__cxx11::string {aka class std::__cxx11::basic_string<char>}'
class basic_string;
^
In file included from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\locale_facets.h:2651:0,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\basic_ios.h:37,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ios:44,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ostream:38,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\iostream:39,
from ..\Time.cpp:8:
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\locale_facets.tcc:697:33: error: invalid use of incomplete type 'std::__cxx11::string {aka class std::__cxx11::basic_string<char>}'
std::__convert_to_v(__xtrc.c_str(), __v, __err, _S_get_c_locale());
^
In file included from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\iosfwd:39:0,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ios:38,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ostream:38,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\iostream:39,
from ..\Time.cpp:8:
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\stringfwd.h:71:11: note: declaration of 'std::__cxx11::string {aka class std::__cxx11::basic_string<char>}'
class basic_string;
^
In file included from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\locale_facets.h:2651:0,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\basic_ios.h:37,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ios:44,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ostream:38,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\iostream:39,
from ..\Time.cpp:8:
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\locale_facets.tcc: In member function 'virtual _InIter std::num_get<_CharT, _InIter>::do_get(std::num_get<_CharT, _InIter>::iter_type, std::num_get<_CharT, _InIter>::iter_type, std::ios_base&, std::ios_base::iostate&, double&) const':
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\locale_facets.tcc:710:13: error: invalid use of incomplete type 'std::__cxx11::string {aka class std::__cxx11::basic_string<char>}'
__xtrc.reserve(32);
^
In file included from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\iosfwd:39:0,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ios:38,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ostream:38,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\iostream:39,
from ..\Time.cpp:8:
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\stringfwd.h:71:11: note: declaration of 'std::__cxx11::string {aka class std::__cxx11::basic_string<char>}'
class basic_string;
^
In file included from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\locale_facets.h:2651:0,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\basic_ios.h:37,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ios:44,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ostream:38,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\iostream:39,
from ..\Time.cpp:8:
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\locale_facets.tcc:712:33: error: invalid use of incomplete type 'std::__cxx11::string {aka class std::__cxx11::basic_string<char>}'
std::__convert_to_v(__xtrc.c_str(), __v, __err, _S_get_c_locale());
^
In file included from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\iosfwd:39:0,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ios:38,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ostream:38,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\iostream:39,
from ..\Time.cpp:8:
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\stringfwd.h:71:11: note: declaration of 'std::__cxx11::string {aka class std::__cxx11::basic_string<char>}'
class basic_string;
^
In file included from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\locale_facets.h:2651:0,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\basic_ios.h:37,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ios:44,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ostream:38,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\iostream:39,
from ..\Time.cpp:8:
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\locale_facets.tcc: In member function 'virtual _InIter std::num_get<_CharT, _InIter>::do_get(std::num_get<_CharT, _InIter>::iter_type, std::num_get<_CharT, _InIter>::iter_type, std::ios_base&, std::ios_base::iostate&, long double&) const':
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\locale_facets.tcc:742:13: error: invalid use of incomplete type 'std::__cxx11::string {aka class std::__cxx11::basic_string<char>}'
__xtrc.reserve(32);
^
In file included from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\iosfwd:39:0,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ios:38,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ostream:38,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\iostream:39,
from ..\Time.cpp:8:
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\stringfwd.h:71:11: note: declaration of 'std::__cxx11::string {aka class std::__cxx11::basic_string<char>}'
class basic_string;
^
In file included from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\locale_facets.h:2651:0,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\basic_ios.h:37,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ios:44,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ostream:38,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\iostream:39,
from ..\Time.cpp:8:
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\locale_facets.tcc:744:33: error: invalid use of incomplete type 'std::__cxx11::string {aka class std::__cxx11::basic_string<char>}'
std::__convert_to_v(__xtrc.c_str(), __v, __err, _S_get_c_locale());
^
In file included from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\iosfwd:39:0,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ios:38,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\ostream:38,
from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\iostream:39,
from ..\Time.cpp:8:
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\stringfwd.h:71:11: note: declaration of 'std::__cxx11::string {aka class std::__cxx11::basic_string<char>}'
class basic_string;
^
12:40:10 Build Finished (took 656ms)
I am using a native install of Windows 10, and am using MinGW installed on my computer. What is strange about this problem is that I will start a new project, the inclusion errors will pop up, making it not be able to build or run, and thus causing the other two errors, I will then battle it for days, following the answers above and get no where. Then out of the blue, I will click "build and run" and the program will build correctly and run properly (so long as I don't changing the code or click "Clean" thereafter). It gets even worse if I try to make a class and include the classes header file, with all the method declarations, in the classes .cpp file with similar errors in the .cpp file as in the example above.
Could this be caused by a faulty insulation of Eclipse CDT, or of MinGW? Are there settings that I could change in Eclipse to designate where to look for its libraries (would that even help?)? Any help is GREATLY appreciated =).
Thanks!
I have a header file called transaction_gen.h and a corresponding cpp file called transaction_gen.cpp.
Here is what I have in transaction_gen.h
#ifndef BITCOIN_TEST_GEN_TRANSACTION_GEN_H
#define BITCOIN_TEST_GEN_TRANSACTION_GEN_H
#include <rapidcheck/gen/Arbitrary.h>
#include <rapidcheck/Gen.h>
#include "primitives/transaction.h"
#include "script/script.h"
#include "amount.h"
#include "test/gen/script_gen.h"
#include "test/gen/crypto_gen.h"
namespace rc {
template<>
struct Arbitrary<COutPoint> {
static Gen<COutPoint> arbitrary() {
return gen::map(gen::tuple(gen::arbitrary<uint256>(), gen::arbitrary<uint32_t>()), [](std::tuple<uint256, uint32_t> outPointPrimitives) {
uint32_t nIn;
uint256 nHashIn;
std::tie(nHashIn, nIn) = outPointPrimitives;
return COutPoint(nHashIn, nIn);
});
};
};
template<>
struct Arbitrary<CTxIn> {
static Gen<CTxIn> arbitrary() {
return gen::map(gen::tuple(gen::arbitrary<COutPoint>(), gen::arbitrary<CScript>(), gen::arbitrary<uint32_t>()), [](std::tuple<COutPoint, CScript, uint32_t> txInPrimitives) {
COutPoint outpoint;
CScript script;
uint32_t sequence;
std::tie(outpoint,script,sequence) = txInPrimitives;
return CTxIn(outpoint,script,sequence);
});
};
};
/** Generates one or more inputs */
Gen<std::vector<CTxIn>> oneOrMoreInputs();
template<>
struct Arbitrary<CAmount> {
static Gen<CAmount> arbitrary() {
//why doesn't this generator call work? It seems to cause an infinite loop.
//return gen::arbitrary<int64_t>();
return gen::inRange(std::numeric_limits<int64_t>::min(),std::numeric_limits<int64_t>::max());
};
};
template<>
struct Arbitrary<CTxOut> {
static Gen<CTxOut> arbitrary() {
return gen::map(gen::tuple(gen::arbitrary<CAmount>(), gen::arbitrary<CScript>()), [](std::tuple<CAmount, CScript> txOutPrimitives) {
CAmount amount;
CScript script;
std::tie(amount,script) = txOutPrimitives;
return CTxOut(amount,script);
});
};
};
and here is what I have in the corresponding cpp file
#include <rapidcheck/gen/Arbitrary.h>
#include <rapidcheck/Gen.h>
#include "primitives/transaction.h"
#include "script/script.h"
#include "amount.h"
#include "test/gen/transaction_gen.h"
namespace rc {
/** Generates one or more inputs */
Gen<std::vector<CTxIn>> oneOrMoreInputs() {
return gen::suchThat(gen::arbitrary<std::vector<CTxIn>>(), [](std::vector<CTxIn> vin) {
return vin.size() > 0;
});
}
/** Generates one or more outputs */
Gen<std::vector<CTxOut>> oneOrMoreOutputs() {
return gen::suchThat(gen::arbitrary<std::vector<CTxOut>>(), [](std::vector<CTxOut> vout) {
return vout.size() > 0;
});
}
}
and this will compile fine when I build my program.
However, since I want to be using functionality located in transaction_gen.h I obviously want to include it in my program. However, when I include it I get a long nasty error message:
chris#chris-870Z5E-880Z5E-680Z5E:~/.../src/test$ make
make -C .. bitcoin_test
make[1]: Entering directory `/home/chris/dev/bitcoin/src'
CXX test/test_test_bitcoin-transaction_properties.o
CXX test/gen/test_test_bitcoin-transaction_gen.o
In file included from ./test/gen/script_gen.h:6:0,
from ./test/gen/transaction_gen.h:9,
from test/gen/transaction_gen.cpp:8:
./test/gen/crypto_gen.h: In static member function ‘static rc::Gen<CKey> rc::Arbitrary<CKey>::arbitrary()’:
./test/gen/crypto_gen.h:19:8: error: no matching function for call to ‘map(rc::Arbitrary<CKey>::arbitrary()::<lambda(int)>)’
});
^
In file included from /usr/local/include/rapidcheck/Gen.h:74:0,
from /usr/local/include/rapidcheck/gen/Arbitrary.h:3,
from test/gen/transaction_gen.cpp:1:
/usr/local/include/rapidcheck/Gen.hpp:15:54: note: candidate: template<class T, class Mapper> rc::Gen<typename std::decay<typename std::result_of<Mapper(T)>::type>::type> rc::gen::map(rc::Gen<T>, Mapper&&)
Gen<Decay<typename std::result_of<Mapper(T)>::type>> map(Gen<T> gen,
^
/usr/local/include/rapidcheck/Gen.hpp:15:54: note: template argument deduction/substitution failed:
In file included from ./test/gen/script_gen.h:6:0,
from ./test/gen/transaction_gen.h:9,
from test/gen/transaction_gen.cpp:8:
./test/gen/crypto_gen.h:19:8: note: candidate expects 2 arguments, 1 provided
});
^
./test/gen/crypto_gen.h: In static member function ‘static rc::Gen<std::vector<unsigned char, secure_allocator<unsigned char> > > rc::Arbitrary<std::vector<unsigned char, secure_allocator<unsigned char> > >::arbitrary()’:
./test/gen/crypto_gen.h:29:8: error: no matching function for call to ‘map(rc::Arbitrary<std::vector<unsigned char, secure_allocator<unsigned char> > >::arbitrary()::<lambda(CKey)>)’
});
^
In file included from /usr/local/include/rapidcheck/Gen.h:74:0,
from /usr/local/include/rapidcheck/gen/Arbitrary.h:3,
from test/gen/transaction_gen.cpp:1:
/usr/local/include/rapidcheck/Gen.hpp:15:54: note: candidate: template<class T, class Mapper> rc::Gen<typename std::decay<typename std::result_of<Mapper(T)>::type>::type> rc::gen::map(rc::Gen<T>, Mapper&&)
Gen<Decay<typename std::result_of<Mapper(T)>::type>> map(Gen<T> gen,
^
/usr/local/include/rapidcheck/Gen.hpp:15:54: note: template argument deduction/substitution failed:
In file included from ./test/gen/script_gen.h:6:0,
from ./test/gen/transaction_gen.h:9,
from test/gen/transaction_gen.cpp:8:
./test/gen/crypto_gen.h:29:8: note: candidate expects 2 arguments, 1 provided
});
^
./test/gen/crypto_gen.h: In static member function ‘static rc::Gen<CPubKey> rc::Arbitrary<CPubKey>::arbitrary()’:
./test/gen/crypto_gen.h:39:8: error: no matching function for call to ‘map(rc::Arbitrary<CPubKey>::arbitrary()::<lambda(CKey)>)’
});
^
In file included from /usr/local/include/rapidcheck/Gen.h:74:0,
from /usr/local/include/rapidcheck/gen/Arbitrary.h:3,
from test/gen/transaction_gen.cpp:1:
/usr/local/include/rapidcheck/Gen.hpp:15:54: note: candidate: template<class T, class Mapper> rc::Gen<typename std::decay<typename std::result_of<Mapper(T)>::type>::type> rc::gen::map(rc::Gen<T>, Mapper&&)
Gen<Decay<typename std::result_of<Mapper(T)>::type>> map(Gen<T> gen,
^
/usr/local/include/rapidcheck/Gen.hpp:15:54: note: template argument deduction/substitution failed:
In file included from ./test/gen/script_gen.h:6:0,
from ./test/gen/transaction_gen.h:9,
from test/gen/transaction_gen.cpp:8:
./test/gen/crypto_gen.h:39:8: note: candidate expects 2 arguments, 1 provided
});
^
./test/gen/crypto_gen.h: In static member function ‘static rc::Gen<uint256> rc::Arbitrary<uint256>::arbitrary()’:
./test/gen/crypto_gen.h:49:8: error: no matching function for call to ‘map(rc::Arbitrary<uint256>::arbitrary()::<lambda(int)>)’
});
^
In file included from /usr/local/include/rapidcheck/Gen.h:74:0,
from /usr/local/include/rapidcheck/gen/Arbitrary.h:3,
from test/gen/transaction_gen.cpp:1:
/usr/local/include/rapidcheck/Gen.hpp:15:54: note: candidate: template<class T, class Mapper> rc::Gen<typename std::decay<typename std::result_of<Mapper(T)>::type>::type> rc::gen::map(rc::Gen<T>, Mapper&&)
Gen<Decay<typename std::result_of<Mapper(T)>::type>> map(Gen<T> gen,
^
/usr/local/include/rapidcheck/Gen.hpp:15:54: note: template argument deduction/substitution failed:
In file included from ./test/gen/script_gen.h:6:0,
from ./test/gen/transaction_gen.h:9,
from test/gen/transaction_gen.cpp:8:
./test/gen/crypto_gen.h:49:8: note: candidate expects 2 arguments, 1 provided
});
^
In file included from /usr/local/include/rapidcheck/gen/Arbitrary.h:22:0,
from test/gen/transaction_gen.cpp:1:
/usr/local/include/rapidcheck/gen/Arbitrary.hpp: In instantiation of ‘struct rc::Arbitrary<std::vector<unsigned char> >’:
/usr/local/include/rapidcheck/gen/Arbitrary.h:17:33: required by substitution of ‘template<class T> decltype (rc::Arbitrary<T>::arbitrary()) rc::gen::arbitrary() [with T = std::vector<unsigned char>]’
./test/gen/script_gen.h:13:66: required from here
/usr/local/include/rapidcheck/gen/Arbitrary.hpp:22:62: error: incomplete type ‘rc::gen::detail::DefaultArbitrary<std::vector<unsigned char> >’ used in nested name specifier
static decltype(gen::detail::DefaultArbitrary<T>::arbitrary()) arbitrary() {
^
In file included from ./test/gen/transaction_gen.h:9:0,
from test/gen/transaction_gen.cpp:8:
./test/gen/script_gen.h: In static member function ‘static rc::Gen<CScript> rc::Arbitrary<CScript>::arbitrary()’:
./test/gen/script_gen.h:13:66: error: no matching function for call to ‘arbitrary()’
return gen::map(gen::arbitrary<std::vector<unsigned char>>(), [](std::vector<unsigned char> script) {
^
In file included from /usr/local/include/rapidcheck/gen/Arbitrary.h:22:0,
from test/gen/transaction_gen.cpp:1:
/usr/local/include/rapidcheck/gen/Arbitrary.hpp:13:37: note: candidate: template<class T> decltype (rc::Arbitrary<T>::arbitrary()) rc::gen::arbitrary()
decltype(Arbitrary<T>::arbitrary()) arbitrary() {
^
/usr/local/include/rapidcheck/gen/Arbitrary.hpp:13:37: note: substitution of deduced template arguments resulted in errors seen above
In file included from test/gen/transaction_gen.cpp:8:0:
./test/gen/transaction_gen.h: In static member function ‘static rc::Gen<COutPoint> rc::Arbitrary<COutPoint>::arbitrary()’:
./test/gen/transaction_gen.h:17:23: error: ‘tuple’ is not a member of ‘rc::gen’
return gen::map(gen::tuple(gen::arbitrary<uint256>(), gen::arbitrary<uint32_t>()), [](std::tuple<uint256, uint32_t> outPointPrimitives) {
^
./test/gen/transaction_gen.h:17:23: note: suggested alternative:
In file included from /usr/include/c++/5/bits/stl_algobase.h:64:0,
from /usr/include/c++/5/memory:62,
from /usr/local/include/rapidcheck/Seq.h:4,
from /usr/local/include/rapidcheck/Shrinkable.h:3,
from /usr/local/include/rapidcheck/Gen.h:4,
from /usr/local/include/rapidcheck/gen/Arbitrary.h:3,
from test/gen/transaction_gen.cpp:1:
/usr/include/c++/5/bits/stl_pair.h:83:11: note: ‘std::tuple’
class tuple;
^
In file included from /usr/local/include/rapidcheck/gen/Arbitrary.h:22:0,
from test/gen/transaction_gen.cpp:1:
/usr/local/include/rapidcheck/gen/Arbitrary.hpp: In instantiation of ‘struct rc::Arbitrary<unsigned int>’:
/usr/local/include/rapidcheck/gen/Arbitrary.h:17:33: required by substitution of ‘template<class T> decltype (rc::Arbitrary<T>::arbitrary()) rc::gen::arbitrary() [with T = unsigned int]’
./test/gen/transaction_gen.h:17:86: required from here
/usr/local/include/rapidcheck/gen/Arbitrary.hpp:22:62: error: incomplete type ‘rc::gen::detail::DefaultArbitrary<unsigned int>’ used in nested name specifier
static decltype(gen::detail::DefaultArbitrary<T>::arbitrary()) arbitrary() {
^
In file included from test/gen/transaction_gen.cpp:8:0:
./test/gen/transaction_gen.h:17:86: error: no matching function for call to ‘arbitrary()’
return gen::map(gen::tuple(gen::arbitrary<uint256>(), gen::arbitrary<uint32_t>()), [](std::tuple<uint256, uint32_t> outPointPrimitives) {
^
In file included from /usr/local/include/rapidcheck/gen/Arbitrary.h:22:0,
from test/gen/transaction_gen.cpp:1:
/usr/local/include/rapidcheck/gen/Arbitrary.hpp:13:37: note: candidate: template<class T> decltype (rc::Arbitrary<T>::arbitrary()) rc::gen::arbitrary()
decltype(Arbitrary<T>::arbitrary()) arbitrary() {
^
/usr/local/include/rapidcheck/gen/Arbitrary.hpp:13:37: note: substitution of deduced template arguments resulted in errors seen above
In file included from test/gen/transaction_gen.cpp:8:0:
./test/gen/transaction_gen.h: In static member function ‘static rc::Gen<CTxIn> rc::Arbitrary<CTxIn>::arbitrary()’:
./test/gen/transaction_gen.h:30:23: error: ‘tuple’ is not a member of ‘rc::gen’
return gen::map(gen::tuple(gen::arbitrary<COutPoint>(), gen::arbitrary<CScript>(), gen::arbitrary<uint32_t>()), [](std::tuple<COutPoint, CScript, uint32_t> txInPrimitives) {
^
./test/gen/transaction_gen.h:30:23: note: suggested alternative:
In file included from /usr/include/c++/5/bits/stl_algobase.h:64:0,
from /usr/include/c++/5/memory:62,
from /usr/local/include/rapidcheck/Seq.h:4,
from /usr/local/include/rapidcheck/Shrinkable.h:3,
from /usr/local/include/rapidcheck/Gen.h:4,
from /usr/local/include/rapidcheck/gen/Arbitrary.h:3,
from test/gen/transaction_gen.cpp:1:
/usr/include/c++/5/bits/stl_pair.h:83:11: note: ‘std::tuple’
class tuple;
^
In file included from test/gen/transaction_gen.cpp:8:0:
./test/gen/transaction_gen.h:30:115: error: no matching function for call to ‘arbitrary()’
return gen::map(gen::tuple(gen::arbitrary<COutPoint>(), gen::arbitrary<CScript>(), gen::arbitrary<uint32_t>()), [](std::tuple<COutPoint, CScript, uint32_t> txInPrimitives) {
^
In file included from /usr/local/include/rapidcheck/gen/Arbitrary.h:22:0,
from test/gen/transaction_gen.cpp:1:
/usr/local/include/rapidcheck/gen/Arbitrary.hpp:13:37: note: candidate: template<class T> decltype (rc::Arbitrary<T>::arbitrary()) rc::gen::arbitrary()
decltype(Arbitrary<T>::arbitrary()) arbitrary() {
^
/usr/local/include/rapidcheck/gen/Arbitrary.hpp:13:37: note: template argument deduction/substitution failed:
In file included from test/gen/transaction_gen.cpp:1:0:
/usr/local/include/rapidcheck/gen/Arbitrary.h: In substitution of ‘template<class T> decltype (rc::Arbitrary<T>::arbitrary()) rc::gen::arbitrary() [with T = unsigned int]’:
./test/gen/transaction_gen.h:30:115: required from here
/usr/local/include/rapidcheck/gen/Arbitrary.h:17:33: error: ‘arbitrary’ is not a member of ‘rc::Arbitrary<unsigned int>’
decltype(Arbitrary<T>::arbitrary()) arbitrary();
^
In file included from test/gen/transaction_gen.cpp:8:0:
./test/gen/transaction_gen.h: In static member function ‘static rc::Gen<long int> rc::Arbitrary<long int>::arbitrary()’:
./test/gen/transaction_gen.h:48:14: error: ‘inRange’ is not a member of ‘rc::gen’
return gen::inRange(std::numeric_limits<int64_t>::min(),std::numeric_limits<int64_t>::max());
^
./test/gen/transaction_gen.h: In static member function ‘static rc::Gen<CTxOut> rc::Arbitrary<CTxOut>::arbitrary()’:
./test/gen/transaction_gen.h:55:23: error: ‘tuple’ is not a member of ‘rc::gen’
return gen::map(gen::tuple(gen::arbitrary<CAmount>(), gen::arbitrary<CScript>()), [](std::tuple<CAmount, CScript> txOutPrimitives) {
^
./test/gen/transaction_gen.h:55:23: note: suggested alternative:
In file included from /usr/include/c++/5/bits/stl_algobase.h:64:0,
from /usr/include/c++/5/memory:62,
from /usr/local/include/rapidcheck/Seq.h:4,
from /usr/local/include/rapidcheck/Shrinkable.h:3,
from /usr/local/include/rapidcheck/Gen.h:4,
from /usr/local/include/rapidcheck/gen/Arbitrary.h:3,
from test/gen/transaction_gen.cpp:1:
/usr/include/c++/5/bits/stl_pair.h:83:11: note: ‘std::tuple’
class tuple;
^
test/gen/transaction_gen.cpp: In function ‘rc::Gen<std::vector<CTxIn> > rc::oneOrMoreInputs()’:
test/gen/transaction_gen.cpp:14:12: error: ‘suchThat’ is not a member of ‘rc::gen’
return gen::suchThat(gen::arbitrary<std::vector<CTxIn>>(), [](std::vector<CTxIn> vin) {
^
In file included from /usr/local/include/rapidcheck/gen/Arbitrary.h:22:0,
from test/gen/transaction_gen.cpp:1:
/usr/local/include/rapidcheck/gen/Arbitrary.hpp: In instantiation of ‘struct rc::Arbitrary<std::vector<CTxIn> >’:
/usr/local/include/rapidcheck/gen/Arbitrary.h:17:33: required by substitution of ‘template<class T> decltype (rc::Arbitrary<T>::arbitrary()) rc::gen::arbitrary() [with T = std::vector<CTxIn>]’
test/gen/transaction_gen.cpp:14:61: required from here
/usr/local/include/rapidcheck/gen/Arbitrary.hpp:22:62: error: incomplete type ‘rc::gen::detail::DefaultArbitrary<std::vector<CTxIn> >’ used in nested name specifier
static decltype(gen::detail::DefaultArbitrary<T>::arbitrary()) arbitrary() {
^
test/gen/transaction_gen.cpp:14:61: error: no matching function for call to ‘arbitrary()’
return gen::suchThat(gen::arbitrary<std::vector<CTxIn>>(), [](std::vector<CTxIn> vin) {
^
In file included from /usr/local/include/rapidcheck/gen/Arbitrary.h:22:0,
from test/gen/transaction_gen.cpp:1:
/usr/local/include/rapidcheck/gen/Arbitrary.hpp:13:37: note: candidate: template<class T> decltype (rc::Arbitrary<T>::arbitrary()) rc::gen::arbitrary()
decltype(Arbitrary<T>::arbitrary()) arbitrary() {
^
/usr/local/include/rapidcheck/gen/Arbitrary.hpp:13:37: note: substitution of deduced template arguments resulted in errors seen above
test/gen/transaction_gen.cpp: In function ‘rc::Gen<std::vector<CTxOut> > rc::oneOrMoreOutputs()’:
test/gen/transaction_gen.cpp:21:12: error: ‘suchThat’ is not a member of ‘rc::gen’
return gen::suchThat(gen::arbitrary<std::vector<CTxOut>>(), [](std::vector<CTxOut> vout) {
^
In file included from /usr/local/include/rapidcheck/gen/Arbitrary.h:22:0,
from test/gen/transaction_gen.cpp:1:
/usr/local/include/rapidcheck/gen/Arbitrary.hpp: In instantiation of ‘struct rc::Arbitrary<std::vector<CTxOut> >’:
/usr/local/include/rapidcheck/gen/Arbitrary.h:17:33: required by substitution of ‘template<class T> decltype (rc::Arbitrary<T>::arbitrary()) rc::gen::arbitrary() [with T = std::vector<CTxOut>]’
test/gen/transaction_gen.cpp:21:62: required from here
/usr/local/include/rapidcheck/gen/Arbitrary.hpp:22:62: error: incomplete type ‘rc::gen::detail::DefaultArbitrary<std::vector<CTxOut> >’ used in nested name specifier
static decltype(gen::detail::DefaultArbitrary<T>::arbitrary()) arbitrary() {
^
test/gen/transaction_gen.cpp:21:62: error: no matching function for call to ‘arbitrary()’
return gen::suchThat(gen::arbitrary<std::vector<CTxOut>>(), [](std::vector<CTxOut> vout) {
^
In file included from /usr/local/include/rapidcheck/gen/Arbitrary.h:22:0,
from test/gen/transaction_gen.cpp:1:
/usr/local/include/rapidcheck/gen/Arbitrary.hpp:13:37: note: candidate: template<class T> decltype (rc::Arbitrary<T>::arbitrary()) rc::gen::arbitrary()
decltype(Arbitrary<T>::arbitrary()) arbitrary() {
^
/usr/local/include/rapidcheck/gen/Arbitrary.hpp:13:37: note: substitution of deduced template arguments resulted in errors seen above
make[1]: *** [test/gen/test_test_bitcoin-transaction_gen.o] Error 1
make[1]: Leaving directory `/home/chris/dev/bitcoin/src'
make: *** [all] Error 2
and I'm not really sure why this is happening. It almost seems like when I include transaction_gen.h it erases all other header files I had included, this the problems like
In file included from ./test/gen/script_gen.h:6:0,
from ./test/gen/transaction_gen.h:9,
from test/gen/transaction_gen.cpp:8:
./test/gen/crypto_gen.h: In static member function ‘static rc::Gen<CKey> rc::Arbitrary<CKey>::arbitrary()’:
./test/gen/crypto_gen.h:19:8: error: no matching function for call to ‘map(rc::Arbitrary<CKey>::arbitrary()::<lambda(int)>)’
});
because this obviously is included properly when I exclude transaction_gen.h. Where am I going wrong here? I feel like this is a pretty simple fix but I've spent a couple hours on it now to avail :/
EDIT: I've pushed this up to github
Here is transaction_gen.h
Here is transaction_gen.cpp
Try remove these lines from transaction_gen.cpp:
#include <rapidcheck/gen/Arbitrary.h>
#include <rapidcheck/Gen.h>
#include "primitives/transaction.h"
#include "script/script.h"
#include "amount.h"
Keep this #include line only:
#include "test/gen/transaction_gen.h"
Your transaction_gen.h is missing a #endif at the end of the file.
Include these in your cpp file also
#include "test/gen/script_gen.h"
#include "test/gen/crypto_gen.h"
I am trying to replicate tensorflow serving examples from https://tensorflow.github.io/serving/serving_advanced.html
But I get following error. It is possibly Tensorflow library error. Any help will be greatly appreciated.
:
~/serving$ bazel build //tensorflow_serving/example:mnist_inference_2
INFO: Found 1 target...
ERROR: /home/ubuntu/serving/tensorflow_serving/session_bundle/BUILD:125:1: C++ compilation of rule '//tensorflow_serving/session_bundle:session_bundle' failed: gcc failed: error executing command /usr/bin/gcc -U_FORTIFY_SOURCE '-D_FORTIFY_SOURCE=1' -fstack-protector -Wall -Wl,-z,-relro,-z,now -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer '-std=c++0x' -iquote . ... (remaining 103 argument(s) skipped): com.google.devtools.build.lib.shell.BadExitStatusException: Process exited with status 1.
In file included from ./tensorflow_serving/session_bundle/session_bundle.h:30:0,
from tensorflow_serving/session_bundle/session_bundle.cc:16:
./tensorflow_serving/session_bundle/signature.h:40:22: error: 'Signatures' has not been declared
Signatures* signatures);
^
./tensorflow_serving/session_bundle/signature.h:43:28: error: 'Signatures' does not name a type
Status SetSignatures(const Signatures& signatures,
^
./tensorflow_serving/session_bundle/signature.h:43:40: error: ISO C++ forbids declaration of 'signatures' with no type [-fpermissive]
Status SetSignatures(const Signatures& signatures,
^
./tensorflow_serving/session_bundle/signature.h:51:5: error: 'ClassificationSignature' has not been declared
ClassificationSignature* signature);
^
./tensorflow_serving/session_bundle/signature.h:58:5: error: 'ClassificationSignature' has not been declared
ClassificationSignature* signature);
^
./tensorflow_serving/session_bundle/signature.h:64:31: error: 'RegressionSignature' has not been declared
RegressionSignature* signature);
^
./tensorflow_serving/session_bundle/signature.h:73:32: error: 'ClassificationSignature' does not name a type
Status RunClassification(const ClassificationSignature& signature,
^
./tensorflow_serving/session_bundle/signature.h:73:57: error: ISO C++ forbids declaration of 'signature' with no type [-fpermissive]
Status RunClassification(const ClassificationSignature& signature,
^
./tensorflow_serving/session_bundle/signature.h:83:28: error: 'RegressionSignature' does not name a type
Status RunRegression(const RegressionSignature& signature, const Tensor& input,
^
./tensorflow_serving/session_bundle/signature.h:83:49: error: ISO C++ forbids declaration of 'signature' with no type [-fpermissive]
Status RunRegression(const RegressionSignature& signature, const Tensor& input,
^
./tensorflow_serving/session_bundle/signature.h:90:28: error: 'GenericSignature' has not been declared
GenericSignature* signature);
^
./tensorflow_serving/session_bundle/signature.h:94:28: error: 'Signature' has not been declared
Signature* default_signature);
^
./tensorflow_serving/session_bundle/signature.h:100:26: error: 'Signature' has not been declared
Signature* default_signature);
^
./tensorflow_serving/session_bundle/signature.h:106:32: error: 'GenericSignature' does not name a type
Status BindGenericInputs(const GenericSignature& signature,
^
./tensorflow_serving/session_bundle/signature.h:106:50: error: ISO C++ forbids declaration of 'signature' with no type [-fpermissive]
Status BindGenericInputs(const GenericSignature& signature,
^
./tensorflow_serving/session_bundle/signature.h:117:31: error: 'GenericSignature' does not name a type
Status BindGenericNames(const GenericSignature& signature,
^
./tensorflow_serving/session_bundle/signature.h:117:49: error: ISO C++ forbids declaration of 'signature' with no type [-fpermissive]
Status BindGenericNames(const GenericSignature& signature,
^
tensorflow_serving/session_bundle/session_bundle.cc:68:49: error: 'AssetFile' was not declared in this scope
const std::vector<AssetFile>& asset_files,
^
tensorflow_serving/session_bundle/session_bundle.cc:68:49: note: suggested alternative:
In file included from ./tensorflow_serving/session_bundle/manifest.pb.h:19:0,
from ./tensorflow_serving/session_bundle/session_bundle.h:29,
from tensorflow_serving/session_bundle/session_bundle.cc:16:
bazel-out/local-fastbuild/genfiles/external/org_tensorflow/tensorflow/contrib/session_bundle/manifest.pb.h:237:7: note: 'tensorflow::contrib::AssetFile'
class AssetFile : public ::google::protobuf::Message {
^
tensorflow_serving/session_bundle/session_bundle.cc:68:58: error: template argument 1 is invalid
const std::vector<AssetFile>& asset_files,
^
tensorflow_serving/session_bundle/session_bundle.cc:68:58: error: template argument 2 is invalid
tensorflow_serving/session_bundle/session_bundle.cc: In function 'void tensorflow::serving::{anonymous}::AddAssetsTensorsToInputs(tensorflow::StringPiece, const int&, std::vector<std::pair<std::basic_string<char>, tensorflow::Tensor> >*)':
tensorflow_serving/session_bundle/session_bundle.cc:70:20: error: request for member 'empty' in 'asset_files', which is of non-class type 'const int'
if (!asset_files.empty()) {
^
tensorflow_serving/session_bundle/session_bundle.cc:71:24: error: no matching function for call to 'begin(const int&)'
for (auto& asset : asset_files) {
^
tensorflow_serving/session_bundle/session_bundle.cc:71:24: note: candidates are:
In file included from /usr/include/c++/4.8/string:51:0,
from /usr/include/c++/4.8/stdexcept:39,
from /usr/include/c++/4.8/array:38,
from /usr/include/c++/4.8/tuple:39,
from /usr/include/c++/4.8/functional:55,
from /usr/include/c++/4.8/memory:79,
from ./tensorflow_serving/session_bundle/session_bundle.h:21,
from tensorflow_serving/session_bundle/session_bundle.cc:16:
/usr/include/c++/4.8/bits/range_access.h:87:5: note: template<class _Tp, long unsigned int _Nm> _Tp* std::begin(_Tp (&)[_Nm])
begin(_Tp (&__arr)[_Nm])
^
/usr/include/c++/4.8/bits/range_access.h:87:5: note: template argument deduction/substitution failed:
tensorflow_serving/session_bundle/session_bundle.cc:71:24: note: mismatched types '_Tp [_Nm]' and 'const int'
for (auto& asset : asset_files) {
^
In file included from /usr/include/c++/4.8/string:51:0,
from /usr/include/c++/4.8/stdexcept:39,
from /usr/include/c++/4.8/array:38,
from /usr/include/c++/4.8/tuple:39,
from /usr/include/c++/4.8/functional:55,
from /usr/include/c++/4.8/memory:79,
from ./tensorflow_serving/session_bundle/session_bundle.h:21,
from tensorflow_serving/session_bundle/session_bundle.cc:16:
/usr/include/c++/4.8/bits/range_access.h:58:5: note: template<class _Container> decltype (__cont.begin()) std::begin(const _Container&)
begin(const _Container& __cont) -> decltype(__cont.begin())
^
/usr/include/c++/4.8/bits/range_access.h:58:5: note: template argument deduction/substitution failed:
/usr/include/c++/4.8/bits/range_access.h: In substitution of 'template<class _Container> decltype (__cont.begin()) std::begin(const _Container&) [with _Container = int]':
tensorflow_serving/session_bundle/session_bundle.cc:71:24: required from here
/usr/include/c++/4.8/bits/range_access.h:58:5: error: request for member 'begin' in '__cont', which is of non-class type 'const int'
/usr/include/c++/4.8/bits/range_access.h:48:5: note: template<class _Container> decltype (__cont.begin()) std::begin(_Container&)
begin(_Container& __cont) -> decltype(__cont.begin())
^
/usr/include/c++/4.8/bits/range_access.h:48:5: note: template argument deduction/substitution failed:
/usr/include/c++/4.8/bits/range_access.h: In substitution of 'template<class _Container> decltype (__cont.begin()) std::begin(_Container&) [with _Container = const int]':
tensorflow_serving/session_bundle/session_bundle.cc:71:24: required from here
/usr/include/c++/4.8/bits/range_access.h:48:5: error: request for member 'begin' in '__cont', which is of non-class type 'const int'
In file included from /usr/include/c++/4.8/utility:74:0,
from /usr/include/c++/4.8/tuple:38,
from /usr/include/c++/4.8/functional:55,
from /usr/include/c++/4.8/memory:79,
from ./tensorflow_serving/session_bundle/session_bundle.h:21,
from tensorflow_serving/session_bundle/session_bundle.cc:16:
/usr/include/c++/4.8/initializer_list:89:5: note: template<class _Tp> constexpr const _Tp* std::begin(std::initializer_list<_Tp>)
begin(initializer_list<_Tp> __ils) noexcept
^
/usr/include/c++/4.8/initializer_list:89:5: note: template argument deduction/substitution failed:
tensorflow_serving/session_bundle/session_bundle.cc:71:24: note: mismatched types 'std::initializer_list<_Tp>' and 'int'
for (auto& asset : asset_files) {
^
tensorflow_serving/session_bundle/session_bundle.cc:71:24: error: no matching function for call to 'end(const int&)'
tensorflow_serving/session_bundle/session_bundle.cc:71:24: note: candidates are:
In file included from /usr/include/c++/4.8/string:51:0,
from /usr/include/c++/4.8/stdexcept:39,
from /usr/include/c++/4.8/array:38,
from /usr/include/c++/4.8/tuple:39,
from /usr/include/c++/4.8/functional:55,
from /usr/include/c++/4.8/memory:79,
from ./tensorflow_serving/session_bundle/session_bundle.h:21,
from tensorflow_serving/session_bundle/session_bundle.cc:16:
/usr/include/c++/4.8/bits/range_access.h:97:5: note: template<class _Tp, long unsigned int _Nm> _Tp* std::end(_Tp (&)[_Nm])
end(_Tp (&__arr)[_Nm])
^
/usr/include/c++/4.8/bits/range_access.h:97:5: note: template argument deduction/substitution failed:
tensorflow_serving/session_bundle/session_bundle.cc:71:24: note: mismatched types '_Tp [_Nm]' and 'const int'
for (auto& asset : asset_files) {
^
In file included from /usr/include/c++/4.8/string:51:0,
from /usr/include/c++/4.8/stdexcept:39,
from /usr/include/c++/4.8/array:38,
from /usr/include/c++/4.8/tuple:39,
from /usr/include/c++/4.8/functional:55,
from /usr/include/c++/4.8/memory:79,
from ./tensorflow_serving/session_bundle/session_bundle.h:21,
from tensorflow_serving/session_bundle/session_bundle.cc:16:
/usr/include/c++/4.8/bits/range_access.h:78:5: note: template<class _Container> decltype (__cont.end()) std::end(const _Container&)
end(const _Container& __cont) -> decltype(__cont.end())
^
/usr/include/c++/4.8/bits/range_access.h:78:5: note: template argument deduction/substitution failed:
/usr/include/c++/4.8/bits/range_access.h: In substitution of 'template<class _Container> decltype (__cont.end()) std::end(const _Container&) [with _Container = int]':
tensorflow_serving/session_bundle/session_bundle.cc:71:24: required from here
/usr/include/c++/4.8/bits/range_access.h:78:5: error: request for member 'end' in '__cont', which is of non-class type 'const int'
/usr/include/c++/4.8/bits/range_access.h:68:5: note: template<class _Container> decltype (__cont.end()) std::end(_Container&)
end(_Container& __cont) -> decltype(__cont.end())
^
/usr/include/c++/4.8/bits/range_access.h:68:5: note: template argument deduction/substitution failed:
/usr/include/c++/4.8/bits/range_access.h: In substitution of 'template<class _Container> decltype (__cont.end()) std::end(_Container&) [with _Container = const int]':
tensorflow_serving/session_bundle/session_bundle.cc:71:24: required from here
/usr/include/c++/4.8/bits/range_access.h:68:5: error: request for member 'end' in '__cont', which is of non-class type 'const int'
In file included from /usr/include/c++/4.8/utility:74:0,
from /usr/include/c++/4.8/tuple:38,
from /usr/include/c++/4.8/functional:55,
from /usr/include/c++/4.8/memory:79,
from ./tensorflow_serving/session_bundle/session_bundle.h:21,
from tensorflow_serving/session_bundle/session_bundle.cc:16:
/usr/include/c++/4.8/initializer_list:99:5: note: template<class _Tp> constexpr const _Tp* std::end(std::initializer_list<_Tp>)
end(initializer_list<_Tp> __ils) noexcept
^
/usr/include/c++/4.8/initializer_list:99:5: note: template argument deduction/substitution failed:
tensorflow_serving/session_bundle/session_bundle.cc:71:24: note: mismatched types 'std::initializer_list<_Tp>' and 'int'
for (auto& asset : asset_files) {
^
tensorflow_serving/session_bundle/session_bundle.cc:76:69: error: no matching function for call to 'std::vector<std::pair<std::basic_string<char>, tensorflow::Tensor> >::push_back(<brace-enclosed initializer list>)'
{asset.tensor_binding().tensor_name(), assets_file_tensor});
^
tensorflow_serving/session_bundle/session_bundle.cc:76:69: note: candidates are:
In file included from /usr/include/c++/4.8/vector:64:0,
from external/protobuf/src/google/protobuf/unknown_field_set.h:43,
from external/protobuf/src/google/protobuf/metadata.h:43,
from bazel-out/local-fastbuild/genfiles/external/org_tensorflow/tensorflow/core/lib/core/error_codes.pb.h:25,
from external/org_tensorflow/tensorflow/core/lib/core/status.h:22,
from ./tensorflow_serving/session_bundle/session_bundle.h:23,
from tensorflow_serving/session_bundle/session_bundle.cc:16:
/usr/include/c++/4.8/bits/stl_vector.h:901:7: note: void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = std::pair<std::basic_string<char>, tensorflow::Tensor>; _Alloc = std::allocator<std::pair<std::basic_string<char>, tensorflow::Tensor> >; std::vector<_Tp, _Alloc>::value_type = std::pair<std::basic_string<char>, tensorflow::Tensor>]
push_back(const value_type& __x)
^
/usr/include/c++/4.8/bits/stl_vector.h:901:7: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const value_type& {aka const std::pair<std::basic_string<char>, tensorflow::Tensor>&}'
/usr/include/c++/4.8/bits/stl_vector.h:919:7: note: void std::vector<_Tp, _Alloc>::push_back(std::vector<_Tp, _Alloc>::value_type&&) [with _Tp = std::pair<std::basic_string<char>, tensorflow::Tensor>; _Alloc = std::allocator<std::pair<std::basic_string<char>, tensorflow::Tensor> >; std::vector<_Tp, _Alloc>::value_type = std::pair<std::basic_string<char>, tensorflow::Tensor>]
push_back(value_type&& __x)
^
/usr/include/c++/4.8/bits/stl_vector.h:919:7: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::vector<std::pair<std::basic_string<char>, tensorflow::Tensor> >::value_type&& {aka std::pair<std::basic_string<char>, tensorflow::Tensor>&&}'
tensorflow_serving/session_bundle/session_bundle.cc: At global scope:
tensorflow_serving/session_bundle/session_bundle.cc:103:39: error: 'AssetFile' was not declared in this scope
const std::vector<AssetFile>& asset_files,
^
tensorflow_serving/session_bundle/session_bundle.cc:103:39: note: suggested alternative:
In file included from ./tensorflow_serving/session_bundle/manifest.pb.h:19:0,
from ./tensorflow_serving/session_bundle/session_bundle.h:29,
from tensorflow_serving/session_bundle/session_bundle.cc:16:
bazel-out/local-fastbuild/genfiles/external/org_tensorflow/tensorflow/contrib/session_bundle/manifest.pb.h:237:7: note: 'tensorflow::contrib::AssetFile'
class AssetFile : public ::google::protobuf::Message {
^
tensorflow_serving/session_bundle/session_bundle.cc:103:48: error: template argument 1 is invalid
const std::vector<AssetFile>& asset_files,
^
tensorflow_serving/session_bundle/session_bundle.cc:103:48: error: template argument 2 is invalid
tensorflow_serving/session_bundle/session_bundle.cc:117:36: error: 'AssetFile' was not declared in this scope
const std::vector<AssetFile>& asset_files,
^
tensorflow_serving/session_bundle/session_bundle.cc:117:36: note: suggested alternative:
In file included from ./tensorflow_serving/session_bundle/manifest.pb.h:19:0,
from ./tensorflow_serving/session_bundle/session_bundle.h:29,
from tensorflow_serving/session_bundle/session_bundle.cc:16:
bazel-out/local-fastbuild/genfiles/external/org_tensorflow/tensorflow/contrib/session_bundle/manifest.pb.h:237:7: note: 'tensorflow::contrib::AssetFile'
class AssetFile : public ::google::protobuf::Message {
^
tensorflow_serving/session_bundle/session_bundle.cc:117:45: error: template argument 1 is invalid
const std::vector<AssetFile>& asset_files,
^
tensorflow_serving/session_bundle/session_bundle.cc:117:45: error: template argument 2 is invalid
tensorflow_serving/session_bundle/session_bundle.cc: In function 'tensorflow::Status tensorflow::serving::LoadSessionBundleFromPath(const tensorflow::SessionOptions&, tensorflow::StringPiece, tensorflow::serving::SessionBundle*)':
tensorflow_serving/session_bundle/session_bundle.cc:165:15: error: 'AssetFile' was not declared in this scope
std::vector<AssetFile> asset_files;
^
tensorflow_serving/session_bundle/session_bundle.cc:165:15: note: suggested alternative:
In file included from ./tensorflow_serving/session_bundle/manifest.pb.h:19:0,
from ./tensorflow_serving/session_bundle/session_bundle.h:29,
from tensorflow_serving/session_bundle/session_bundle.cc:16:
bazel-out/local-fastbuild/genfiles/external/org_tensorflow/tensorflow/contrib/session_bundle/manifest.pb.h:237:7: note: 'tensorflow::contrib::AssetFile'
class AssetFile : public ::google::protobuf::Message {
^
tensorflow_serving/session_bundle/session_bundle.cc:165:24: error: template argument 1 is invalid
std::vector<AssetFile> asset_files;
^
tensorflow_serving/session_bundle/session_bundle.cc:165:24: error: template argument 2 is invalid
tensorflow_serving/session_bundle/session_bundle.cc:165:37: error: invalid type in declaration before ';' token
std::vector<AssetFile> asset_files;
^
tensorflow_serving/session_bundle/session_bundle.cc:170:17: error: expected ';' before 'asset_file'
AssetFile asset_file;
^
tensorflow_serving/session_bundle/session_bundle.cc:171:25: error: the value of 'AssetFile' is not usable in a constant expression
if (!any_asset.Is<AssetFile>()) {
^
tensorflow_serving/session_bundle/session_bundle.cc:165:15: note: 'AssetFile' was not declared 'constexpr'
std::vector<AssetFile> asset_files;
^
tensorflow_serving/session_bundle/session_bundle.cc:171:36: error: no matching function for call to 'google::protobuf::Any::Is() const'
if (!any_asset.Is<AssetFile>()) {
^
tensorflow_serving/session_bundle/session_bundle.cc:171:36: note: candidate is:
In file included from bazel-out/local-fastbuild/genfiles/external/org_tensorflow/tensorflow/core/protobuf/meta_graph.pb.h:32:0,
from ./tensorflow_serving/session_bundle/session_bundle.h:25,
from tensorflow_serving/session_bundle/session_bundle.cc:16:
external/protobuf/src/google/protobuf/any.pb.h:66:29: note: template<class T> bool google::protobuf::Any::Is() const
template<typename T> bool Is() const {
^
external/protobuf/src/google/protobuf/any.pb.h:66:29: note: template argument deduction/substitution failed:
tensorflow_serving/session_bundle/session_bundle.cc:174:13: error: 'asset_file' was not declared in this scope
asset_file.descriptor()->full_name(), ". Got: ",
^
tensorflow_serving/session_bundle/session_bundle.cc:178:32: error: 'asset_file' was not declared in this scope
if (!any_asset.UnpackTo(&asset_file)) {
^
tensorflow_serving/session_bundle/session_bundle.cc:182:19: error: request for member 'push_back' in 'asset_files', which is of non-class type 'int'
asset_files.push_back(asset_file);
^
tensorflow_serving/session_bundle/session_bundle.cc:182:29: error: 'asset_file' was not declared in this scope
asset_files.push_back(asset_file);
^
Target //tensorflow_serving/example:mnist_inference_2 failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 4.822s, Critical Path: 4.54s
From the page you linked: "Before getting started, please complete the prerequisites."
The type Signatures is defined in a header generated by following said prereqs process, so you've either not followed those steps or not followed them correctly – there's no way to tell which just from the compiler errors.
Recently pulled some code to a new system, and I'm having some trouble compiling chrono_io and ratio_io.
I'm unsure what to change, since the errors appear to affect the preprocessor.
It seems like it must be a cross-platform compatibility issue for which the code doesn't account.
Any ideas how I can resolve these preprocessor and compiler errors?
In file included from Test.cc:12:0:
chrono_io:221:18: error: missing binary operator before token "("
#if __has_feature(cxx_rvalue_references)
^
chrono_io:789:18: error: missing binary operator before token "("
#if __has_feature(cxx_rvalue_references)
^
chrono_io:821:18: error: missing binary operator before token "("
#if __has_feature(cxx_rvalue_references)
^
chrono_io:833:18: error: missing binary operator before token "("
#if __has_feature(cxx_rvalue_references)
^
chrono_io:845:18: error: missing binary operator before token "("
#if __has_feature(cxx_rvalue_references)
^
chrono_io:858:18: error: missing binary operator before token "("
#if __has_feature(cxx_rvalue_references)
^
chrono_io:885:18: error: missing binary operator before token "("
#if __has_feature(cxx_rvalue_references)
^
In file included from chrono_io:139:0,
from Test.cc:12:
ratio_io:36:1: error: ‘_LIBCPP_BEGIN_NAMESPACE_STD’ does not name a type
_LIBCPP_BEGIN_NAMESPACE_STD
^
ratio_io:46:1: error: ‘basic_string’ does not name a type
basic_string<_CharT>
^
ratio_io:58:8: error: ‘ratio_string’ is not a class template
struct ratio_string<atto, char>
^
ratio_io:58:21: error: ‘atto’ was not declared in this scope
struct ratio_string<atto, char>
^
ratio_io:58:21: note: suggested alternative:
In file included from /usr/include/c++/4.8.2/chrono:38:0,
from Test.cc:11:
/usr/include/c++/4.8.2/ratio:513:47: note: ‘std::atto’
typedef ratio<1, 1000000000000000000> atto;
^
In file included from chrono_io:139:0,
from Test.cc:12:
ratio_io:59:1: error: explicit specialization of non-template ‘ratio_string’
{
^
ratio_io:60:12: error: ‘string’ does not name a type
static string symbol() {return string(1, 'a');}
^
ratio_io:61:12: error: ‘string’ does not name a type
static string prefix() {return string("atto");}
^
ratio_io:83:8: error: ‘ratio_string’ is not a class template
struct ratio_string<atto, wchar_t>
^
ratio_io:83:21: error: ‘atto’ was not declared in this scope
struct ratio_string<atto, wchar_t>
^
ratio_io:83:21: note: suggested alternative:
In file included from /usr/include/c++/4.8.2/chrono:38:0,
from Test.cc:11:
/usr/include/c++/4.8.2/ratio:513:47: note: ‘std::atto’
typedef ratio<1, 1000000000000000000> atto;
^
In file included from chrono_io:139:0,
from Test.cc:12:
ratio_io:83:34: error: ‘ratio_string’ is not a template type
struct ratio_string<atto, wchar_t>
^
ratio_io:92:8: error: ‘ratio_string’ is not a class template
struct ratio_string<femto, char>
^
ratio_io:92:21: error: ‘femto’ was not declared in this scope
struct ratio_string<femto, char>
^
ratio_io:92:21: note: suggested alternative:
In file included from /usr/include/c++/4.8.2/chrono:38:0,
from Test.cc:11:
/usr/include/c++/4.8.2/ratio:514:47: note: ‘std::femto’
typedef ratio<1, 1000000000000000> femto;
^
In file included from chrono_io:139:0,
from Test.cc:12:
ratio_io:92:32: error: ‘ratio_string’ is not a template type
struct ratio_string<femto, char>
^
ratio_io:117:8: error: ‘ratio_string’ is not a class template
struct ratio_string<femto, wchar_t>
^
ratio_io:117:21: error: ‘femto’ was not declared in this scope
struct ratio_string<femto, wchar_t>
^
ratio_io:117:21: note: suggested alternative:
In file included from /usr/include/c++/4.8.2/chrono:38:0,
from Test.cc:11:
/usr/include/c++/4.8.2/ratio:514:47: note: ‘std::femto’
typedef ratio<1, 1000000000000000> femto;
^
In file included from chrono_io:139:0,
from Test.cc:12:
ratio_io:117:35: error: ‘ratio_string’ is not a template type
struct ratio_string<femto, wchar_t>
^
ratio_io:126:8: error: ‘ratio_string’ is not a class template
struct ratio_string<pico, char>
^
ratio_io:126:21: error: ‘pico’ was not declared in this scope
struct ratio_string<pico, char>
^
ratio_io:126:21: note: suggested alternative:
In file included from /usr/include/c++/4.8.2/chrono:38:0,
from Test.cc:11:
/usr/include/c++/4.8.2/ratio:515:47: note: ‘std::pico’
typedef ratio<1, 1000000000000> pico;
^
In file included from chrono_io:139:0,
from Test.cc:12:
ratio_io:126:31: error: ‘ratio_string’ is not a template type
struct ratio_string<pico, char>
^
ratio_io:151:8: error: ‘ratio_string’ is not a class template
struct ratio_string<pico, wchar_t>
^
ratio_io:151:21: error: ‘pico’ was not declared in this scope
struct ratio_string<pico, wchar_t>
^
ratio_io:151:21: note: suggested alternative:
In file included from /usr/include/c++/4.8.2/chrono:38:0,
from Test.cc:11:
/usr/include/c++/4.8.2/ratio:515:47: note: ‘std::pico’
typedef ratio<1, 1000000000000> pico;
^
In file included from chrono_io:139:0,
from Test.cc:12:
ratio_io:151:34: error: ‘ratio_string’ is not a template type
struct ratio_string<pico, wchar_t>
^
ratio_io:160:8: error: ‘ratio_string’ is not a class template
struct ratio_string<nano, char>
^
ratio_io:160:21: error: ‘nano’ was not declared in this scope
struct ratio_string<nano, char>
^
ratio_io:160:21: note: suggested alternative:
In file included from /usr/include/c++/4.8.2/chrono:38:0,
from Test.cc:11:
/usr/include/c++/4.8.2/ratio:516:47: note: ‘std::nano’
typedef ratio<1, 1000000000> nano;
^
In file included from chrono_io:139:0,
from Test.cc:12:
ratio_io:160:31: error: ‘ratio_string’ is not a template type
struct ratio_string<nano, char>
^
ratio_io:185:8: error: ‘ratio_string’ is not a class template
struct ratio_string<nano, wchar_t>
^
ratio_io:185:21: error: ‘nano’ was not declared in this scope
struct ratio_string<nano, wchar_t>
^
ratio_io:185:21: note: suggested alternative:
In file included from /usr/include/c++/4.8.2/chrono:38:0,
from Test.cc:11:
/usr/include/c++/4.8.2/ratio:516:47: note: ‘std::nano’
typedef ratio<1, 1000000000> nano;
^
In file included from chrono_io:139:0,
from Test.cc:12:
ratio_io:185:34: error: ‘ratio_string’ is not a template type
struct ratio_string<nano, wchar_t>
^
ratio_io:194:8: error: ‘ratio_string’ is not a class template
struct ratio_string<micro, char>
^
ratio_io:194:21: error: ‘micro’ was not declared in this scope
struct ratio_string<micro, char>
^
ratio_io:194:21: note: suggested alternative:
In file included from /usr/include/c++/4.8.2/chrono:38:0,
from Test.cc:11:
/usr/include/c++/4.8.2/ratio:517:47: note: ‘std::micro’
typedef ratio<1, 1000000> micro;
^
In file included from chrono_io:139:0,
from Test.cc:12:
ratio_io:194:32: error: ‘ratio_string’ is not a template type
struct ratio_string<micro, char>
^
ratio_io:219:8: error: ‘ratio_string’ is not a class template
struct ratio_string<micro, wchar_t>
^
ratio_io:219:21: error: ‘micro’ was not declared in this scope
struct ratio_string<micro, wchar_t>
^
ratio_io:219:21: note: suggested alternative:
In file included from /usr/include/c++/4.8.2/chrono:38:0,
from Test.cc:11:
/usr/include/c++/4.8.2/ratio:517:47: note: ‘std::micro’
typedef ratio<1, 1000000> micro;
^
In file included from chrono_io:139:0,
from Test.cc:12:
ratio_io:219:35: error: ‘ratio_string’ is not a template type
struct ratio_string<micro, wchar_t>
^
ratio_io:228:8: error: ‘ratio_string’ is not a class template
struct ratio_string<milli, char>
^
ratio_io:228:21: error: ‘milli’ was not declared in this scope
struct ratio_string<milli, char>
^
ratio_io:228:21: note: suggested alternative:
In file included from /usr/include/c++/4.8.2/chrono:38:0,
from Test.cc:11:
/usr/include/c++/4.8.2/ratio:518:47: note: ‘std::milli’
typedef ratio<1, 1000> milli;
^
In file included from chrono_io:139:0,
from Test.cc:12:
ratio_io:228:32: error: ‘ratio_string’ is not a template type
struct ratio_string<milli, char>
^
ratio_io:253:8: error: ‘ratio_string’ is not a class template
struct ratio_string<milli, wchar_t>
^
ratio_io:253:21: error: ‘milli’ was not declared in this scope
struct ratio_string<milli, wchar_t>
^
ratio_io:253:21: note: suggested alternative:
In file included from /usr/include/c++/4.8.2/chrono:38:0,
from Test.cc:11:
/usr/include/c++/4.8.2/ratio:518:47: note: ‘std::milli’
typedef ratio<1, 1000> milli;
^
In file included from chrono_io:139:0,
from Test.cc:12:
ratio_io:253:35: error: ‘ratio_string’ is not a template type
struct ratio_string<milli, wchar_t>
^
ratio_io:262:8: error: ‘ratio_string’ is not a class template
struct ratio_string<centi, char>
^
ratio_io:262:21: error: ‘centi’ was not declared in this scope
struct ratio_string<centi, char>
^
ratio_io:262:21: note: suggested alternative:
In file included from /usr/include/c++/4.8.2/chrono:38:0,
from Test.cc:11:
/usr/include/c++/4.8.2/ratio:519:47: note: ‘std::centi’
typedef ratio<1, 100> centi;
^
In file included from chrono_io:139:0,
from Test.cc:12:
ratio_io:262:32: error: ‘ratio_string’ is not a template type
struct ratio_string<centi, char>
^
ratio_io:287:8: error: ‘ratio_string’ is not a class template
struct ratio_string<centi, wchar_t>
^
ratio_io:287:21: error: ‘centi’ was not declared in this scope
struct ratio_string<centi, wchar_t>
^
ratio_io:287:21: note: suggested alternative:
In file included from /usr/include/c++/4.8.2/chrono:38:0,
from Test.cc:11:
/usr/include/c++/4.8.2/ratio:519:47: note: ‘std::centi’
typedef ratio<1, 100> centi;
^
In file included from chrono_io:139:0,
from Test.cc:12:
ratio_io:287:35: error: ‘ratio_string’ is not a template type
struct ratio_string<centi, wchar_t>
^
ratio_io:296:8: error: ‘ratio_string’ is not a class template
struct ratio_string<deci, char>
^
ratio_io:296:21: error: ‘deci’ was not declared in this scope
struct ratio_string<deci, char>
^
ratio_io:296:21: note: suggested alternative:
In file included from /usr/include/c++/4.8.2/chrono:38:0,
from Test.cc:11:
/usr/include/c++/4.8.2/ratio:520:47: note: ‘std::deci’
typedef ratio<1, 10> deci;
^
In file included from chrono_io:139:0,
from Test.cc:12:
ratio_io:296:31: error: ‘ratio_string’ is not a template type
struct ratio_string<deci, char>
^
ratio_io:321:8: error: ‘ratio_string’ is not a class template
struct ratio_string<deci, wchar_t>
^
ratio_io:321:21: error: ‘deci’ was not declared in this scope
struct ratio_string<deci, wchar_t>
^
ratio_io:321:21: note: suggested alternative:
In file included from /usr/include/c++/4.8.2/chrono:38:0,
from Test.cc:11:
/usr/include/c++/4.8.2/ratio:520:47: note: ‘std::deci’
typedef ratio<1, 10> deci;
^
In file included from chrono_io:139:0,
from Test.cc:12:
ratio_io:321:34: error: ‘ratio_string’ is not a template type
struct ratio_string<deci, wchar_t>
^
ratio_io:330:8: error: ‘ratio_string’ is not a class template
struct ratio_string<deca, char>
^
ratio_io:330:21: error: ‘deca’ was not declared in this scope
struct ratio_string<deca, char>
^
ratio_io:330:21: note: suggested alternative:
In file included from /usr/include/c++/4.8.2/chrono:38:0,
from Test.cc:11:
/usr/include/c++/4.8.2/ratio:521:47: note: ‘std::deca’
typedef ratio< 10, 1> deca;
^
In file included from chrono_io:139:0,
from Test.cc:12:
ratio_io:330:31: error: ‘ratio_string’ is not a template type
struct ratio_string<deca, char>
^
ratio_io:355:8: error: ‘ratio_string’ is not a class template
struct ratio_string<deca, wchar_t>
^
ratio_io:355:21: error: ‘deca’ was not declared in this scope
struct ratio_string<deca, wchar_t>
^
ratio_io:355:21: note: suggested alternative:
In file included from /usr/include/c++/4.8.2/chrono:38:0,
from Test.cc:11:
/usr/include/c++/4.8.2/ratio:521:47: note: ‘std::deca’
typedef ratio< 10, 1> deca;
^
In file included from chrono_io:139:0,
from Test.cc:12:
ratio_io:355:34: error: ‘ratio_string’ is not a template type
struct ratio_string<deca, wchar_t>
^
ratio_io:364:8: error: ‘ratio_string’ is not a class template
struct ratio_string<hecto, char>
^
ratio_io:364:21: error: ‘hecto’ was not declared in this scope
struct ratio_string<hecto, char>
^
ratio_io:364:21: note: suggested alternative:
In file included from /usr/include/c++/4.8.2/chrono:38:0,
from Test.cc:11:
/usr/include/c++/4.8.2/ratio:522:47: note: ‘std::hecto’
typedef ratio< 100, 1> hecto;
^
In file included from chrono_io:139:0,
from Test.cc:12:
ratio_io:364:32: error: ‘ratio_string’ is not a template type
struct ratio_string<hecto, char>
^
ratio_io:389:8: error: ‘ratio_string’ is not a class template
struct ratio_string<hecto, wchar_t>
^
ratio_io:389:21: error: ‘hecto’ was not declared in this scope
struct ratio_string<hecto, wchar_t>
^
ratio_io:389:21: note: suggested alternative:
In file included from /usr/include/c++/4.8.2/chrono:38:0,
from Test.cc:11:
/usr/include/c++/4.8.2/ratio:522:47: note: ‘std::hecto’
typedef ratio< 100, 1> hecto;
^
In file included from chrono_io:139:0,
from Test.cc:12:
ratio_io:389:35: error: ‘ratio_string’ is not a template type
struct ratio_string<hecto, wchar_t>
^
ratio_io:398:8: error: ‘ratio_string’ is not a class template
struct ratio_string<kilo, char>
^
ratio_io:398:21: error: ‘kilo’ was not declared in this scope
struct ratio_string<kilo, char>
^
ratio_io:398:21: note: suggested alternative:
In file included from /usr/include/c++/4.8.2/chrono:38:0,
from Test.cc:11:
/usr/include/c++/4.8.2/ratio:523:47: note: ‘std::kilo’
typedef ratio< 1000, 1> kilo;
^
In file included from chrono_io:139:0,
from Test.cc:12:
ratio_io:398:31: error: ‘ratio_string’ is not a template type
struct ratio_string<kilo, char>
^
ratio_io:423:8: error: ‘ratio_string’ is not a class template
struct ratio_string<kilo, wchar_t>
^
ratio_io:423:21: error: ‘kilo’ was not declared in this scope
struct ratio_string<kilo, wchar_t>
^
ratio_io:423:21: note: suggested alternative:
In file included from /usr/include/c++/4.8.2/chrono:38:0,
from Test.cc:11:
/usr/include/c++/4.8.2/ratio:523:47: note: ‘std::kilo’
typedef ratio< 1000, 1> kilo;
^
In file included from chrono_io:139:0,
from Test.cc:12:
ratio_io:423:34: error: ‘ratio_string’ is not a template type
struct ratio_string<kilo, wchar_t>
^
ratio_io:432:8: error: ‘ratio_string’ is not a class template
struct ratio_string<mega, char>
^
ratio_io:432:21: error: ‘mega’ was not declared in this scope
struct ratio_string<mega, char>
^
ratio_io:432:21: note: suggested alternative:
In file included from /usr/include/c++/4.8.2/chrono:38:0,
from Test.cc:11:
/usr/include/c++/4.8.2/ratio:524:47: note: ‘std::mega’
typedef ratio< 1000000, 1> mega;
^
In file included from chrono_io:139:0,
from Test.cc:12:
ratio_io:432:31: error: ‘ratio_string’ is not a template type
struct ratio_string<mega, char>
^
ratio_io:457:8: error: ‘ratio_string’ is not a class template
struct ratio_string<mega, wchar_t>
^
ratio_io:457:21: error: ‘mega’ was not declared in this scope
struct ratio_string<mega, wchar_t>
^
ratio_io:457:21: note: suggested alternative:
In file included from /usr/include/c++/4.8.2/chrono:38:0,
from Test.cc:11:
/usr/include/c++/4.8.2/ratio:524:47: note: ‘std::mega’
typedef ratio< 1000000, 1> mega;
^
In file included from chrono_io:139:0,
from Test.cc:12:
ratio_io:457:34: error: ‘ratio_string’ is not a template type
struct ratio_string<mega, wchar_t>
^
ratio_io:466:8: error: ‘ratio_string’ is not a class template
struct ratio_string<giga, char>
^
ratio_io:466:21: error: ‘giga’ was not declared in this scope
struct ratio_string<giga, char>
^
ratio_io:466:21: note: suggested alternative:
In file included from /usr/include/c++/4.8.2/chrono:38:0,
from Test.cc:11:
/usr/include/c++/4.8.2/ratio:525:47: note: ‘std::giga’
typedef ratio< 1000000000, 1> giga;
^
In file included from chrono_io:139:0,
from Test.cc:12:
ratio_io:466:31: error: ‘ratio_string’ is not a template type
struct ratio_string<giga, char>
^
ratio_io:491:8: error: ‘ratio_string’ is not a class template
struct ratio_string<giga, wchar_t>
^
ratio_io:491:21: error: ‘giga’ was not declared in this scope
struct ratio_string<giga, wchar_t>
^
ratio_io:491:21: note: suggested alternative:
In file included from /usr/include/c++/4.8.2/chrono:38:0,
from Test.cc:11:
/usr/include/c++/4.8.2/ratio:525:47: note: ‘std::giga’
typedef ratio< 1000000000, 1> giga;
^
In file included from chrono_io:139:0,
from Test.cc:12:
ratio_io:491:34: error: ‘ratio_string’ is not a template type
struct ratio_string<giga, wchar_t>
^
ratio_io:500:8: error: ‘ratio_string’ is not a class template
struct ratio_string<tera, char>
^
ratio_io:500:21: error: ‘tera’ was not declared in this scope
struct ratio_string<tera, char>
^
ratio_io:500:21: note: suggested alternative:
In file included from /usr/include/c++/4.8.2/chrono:38:0,
from Test.cc:11:
/usr/include/c++/4.8.2/ratio:526:47: note: ‘std::tera’
typedef ratio< 1000000000000, 1> tera;
^
In file included from chrono_io:139:0,
from Test.cc:12:
ratio_io:500:31: error: ‘ratio_string’ is not a template type
struct ratio_string<tera, char>
^
ratio_io:525:8: error: ‘ratio_string’ is not a class template
struct ratio_string<tera, wchar_t>
^
ratio_io:525:21: error: ‘tera’ was not declared in this scope
struct ratio_string<tera, wchar_t>
^
ratio_io:525:21: note: suggested alternative:
In file included from /usr/include/c++/4.8.2/chrono:38:0,
from Test.cc:11:
/usr/include/c++/4.8.2/ratio:526:47: note: ‘std::tera’
typedef ratio< 1000000000000, 1> tera;
^
In file included from chrono_io:139:0,
from Test.cc:12:
ratio_io:525:34: error: ‘ratio_string’ is not a template type
struct ratio_string<tera, wchar_t>
^
ratio_io:534:8: error: ‘ratio_string’ is not a class template
struct ratio_string<peta, char>
^
ratio_io:534:21: error: ‘peta’ was not declared in this scope
struct ratio_string<peta, char>
^
ratio_io:534:21: note: suggested alternative:
In file included from /usr/include/c++/4.8.2/chrono:38:0,
from Test.cc:11:
/usr/include/c++/4.8.2/ratio:527:47: note: ‘std::peta’
typedef ratio< 1000000000000000, 1> peta;
^
In file included from chrono_io:139:0,
from Test.cc:12:
ratio_io:534:31: error: ‘ratio_string’ is not a template type
struct ratio_string<peta, char>
^
ratio_io:559:8: error: ‘ratio_string’ is not a class template
struct ratio_string<peta, wchar_t>
^
ratio_io:559:21: error: ‘peta’ was not declared in this scope
struct ratio_string<peta, wchar_t>
^
ratio_io:559:21: note: suggested alternative:
In file included from /usr/include/c++/4.8.2/chrono:38:0,
from Test.cc:11:
/usr/include/c++/4.8.2/ratio:527:47: note: ‘std::peta’
typedef ratio< 1000000000000000, 1> peta;
^
In file included from chrono_io:139:0,
from Test.cc:12:
ratio_io:559:34: error: ‘ratio_string’ is not a template type
struct ratio_string<peta, wchar_t>
^
ratio_io:568:8: error: ‘ratio_string’ is not a class template
struct ratio_string<exa, char>
^
ratio_io:568:21: error: ‘exa’ was not declared in this scope
struct ratio_string<exa, char>
^
ratio_io:568:21: note: suggested alternative:
In file included from /usr/include/c++/4.8.2/chrono:38:0,
from Test.cc:11:
/usr/include/c++/4.8.2/ratio:528:47: note: ‘std::exa’
typedef ratio< 1000000000000000000, 1> exa;
^
In file included from chrono_io:139:0,
from Test.cc:12:
ratio_io:568:30: error: ‘ratio_string’ is not a template type
struct ratio_string<exa, char>
^
ratio_io:593:8: error: ‘ratio_string’ is not a class template
struct ratio_string<exa, wchar_t>
^
ratio_io:593:21: error: ‘exa’ was not declared in this scope
struct ratio_string<exa, wchar_t>
^
ratio_io:593:21: note: suggested alternative:
In file included from /usr/include/c++/4.8.2/chrono:38:0,
from Test.cc:11:
/usr/include/c++/4.8.2/ratio:528:47: note: ‘std::exa’
typedef ratio< 1000000000000000000, 1> exa;
^
In file included from chrono_io:139:0,
from Test.cc:12:
ratio_io:593:33: error: ‘ratio_string’ is not a template type
struct ratio_string<exa, wchar_t>
^
ratio_io:599:1: error: ‘_LIBCPP_END_NAMESPACE_STD’ does not name a type
_LIBCPP_END_NAMESPACE_STD
^
In file included from Test.cc:12:0:
chrono_io:1164:1: error: ‘_LIBCPP_END_NAMESPACE_STD’ does not name a type
_LIBCPP_END_NAMESPACE_STD
^
Test.cc: In function ‘void RealDataTest()’:
Test.cc:167:12: error: cannot bind ‘std::basic_ostream<char>’ lvalue to ‘std::basic_ostream<char>&&’
std::cout << "Time for n->mostRecent: " << (Clock::now() - start) << std::endl;
^
In file included from /usr/include/c++/4.8.2/iostream:39:0,
from Nearby.cc:9,
from Test.cc:5:
/usr/include/c++/4.8.2/ostream:602:5: error: initializing argument 1 of ‘std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&&, const _Tp&) [with _CharT = char; _Traits = std::char_traits<char>; _Tp = std::chrono::duration<long int, std::ratio<1l, 1000000000l> >]’
operator<<(basic_ostream<_CharT, _Traits>&& __os, const _Tp& __x)
^
Test.cc:185:12: error: cannot bind ‘std::basic_ostream<char>’ lvalue to ‘std::basic_ostream<char>&&’
std::cout << "Time for n->deletePost: " << (Clock::now() - start) << std::endl;
^
In file included from /usr/include/c++/4.8.2/iostream:39:0,
from Nearby.cc:9,
from Test.cc:5:
/usr/include/c++/4.8.2/ostream:602:5: error: initializing argument 1 of ‘std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&&, const _Tp&) [with _CharT = char; _Traits = std::char_traits<char>; _Tp = std::chrono::duration<long int, std::ratio<1l, 1000000000l> >]’
operator<<(basic_ostream<_CharT, _Traits>&& __os, const _Tp& __x)
^
make: *** [all] Error 1
I haven't played with this code in several years. It is using:
#if __has_feature(cxx_rvalue_references)
__seconds_(std::move(__seconds)),
...
to check if the compiler supports rvalue references (C++11 move semantics). My recommendation is to assume that you have C++11 (since you have to have <chrono> and just remove the __has_feature and the #else branch.
If for some reason you have to support a compiler which doesn't have rvalue references you can:
#define __has_feature(x) 0
and this will select the #else branch everywhere.
__has_feature(cxx_rvalue_references) is a clang extension.
Update
Update to this library.
https://howardhinnant.github.io/date/chrono_io.html
It has been simplified to only streaming durations.
I'm trying to compile a simple c++ file that is suppose to use the mariadbc++ connector. For some reason I ran into alot of trouble with that. I get strange error messages. I neither understand them, nor do I know how to fix them.
I did a lot of research, but either nobody else ran into these problems or I just cant find them.
I installed following packages:
mariadb-client
mariadb-client-5.5
mariadb-server
libmariadbclient18
libmysqlclient18
libmysqlcppconn7
libmysqlcppconn-dev
libmariadbclient-dev
libmariadb-dev
I'm on a x64 Ubuntu 14.04 System (well Pinguy OS, but I guess, that doesn't matter)
I tried to build following programm:
#include <my_global.h>
#include <mysql.h>
#include "mysql_driver.h"
int main(int argc, char **argv)
{
sql::mysql::MySQL_Driver *driver;
sql::Connection *con;
sql::Statement *stmt;
driver = sql::mysql::MySQL_Driver::get_mysql_driver_instance();
con = driver->connect("tcp://localhost:3306","root", "herein");
if (!con->isValid()) exit(1);
stmt = con->createStatement();
stmt->execute("use testtb");
stmt->execute("INSERT INTO Testtable(id, label) VALUES (1, 1)");
delete stmt;
delete con;
return 1;
}
And I tried this command:
g++ -lmysqlcppconn -g src/test_mariadb.cpp -o bin/test_mariadb $(mysql_config --cflags) $(mysql_config --libs)
where under in src/ my source files are and in bin/ my binaries.
And finally the Compile Errors I get:
In file included from /usr/include/c++/4.8/bits/char_traits.h:39:0,
from /usr/include/c++/4.8/ios:40,
from /usr/include/c++/4.8/ostream:38,
from /usr/include/c++/4.8/iostream:39,
from /usr/include/boost/assert.hpp:82,
from /usr/include/boost/smart_ptr/scoped_ptr.hpp:15,
from /usr/include/boost/scoped_ptr.hpp:14,
from /usr/include/mysql_driver.h:30,
from src/test_mariadb.cpp:3:
/usr/include/c++/4.8/bits/stl_algobase.h:239:56: error: macro "min" passed 3 arguments, but takes just 2
min(const _Tp& __a, const _Tp& __b, _Compare __comp)
^
/usr/include/c++/4.8/bits/stl_algobase.h:260:56: error: macro "max" passed 3 arguments, but takes just 2
max(const _Tp& __a, const _Tp& __b, _Compare __comp)
^
In file included from /usr/include/boost/mpl/aux_/begin_end_impl.hpp:21:0,
from /usr/include/boost/mpl/begin_end.hpp:18,
from /usr/include/boost/mpl/iter_fold.hpp:18,
from /usr/include/boost/variant/detail/initializer.hpp:28,
from /usr/include/boost/variant/variant.hpp:31,
from /usr/include/boost/variant.hpp:17,
from /usr/include/cppconn/connection.h:31,
from /usr/include/cppconn/driver.h:30,
from /usr/include/mysql_driver.h:32,
from src/test_mariadb.cpp:3:
/usr/include/boost/mpl/aux_/has_begin.hpp:20:57: error: macro "test" passed 2 arguments, but takes just 1
BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF(has_begin, begin, true)
^
In file included from /usr/include/boost/mpl/sequence_tag.hpp:18:0,
from /usr/include/boost/mpl/begin_end.hpp:19,
from /usr/include/boost/mpl/iter_fold.hpp:18,
from /usr/include/boost/variant/detail/initializer.hpp:28,
from /usr/include/boost/variant/variant.hpp:31,
from /usr/include/boost/variant.hpp:17,
from /usr/include/cppconn/connection.h:31,
from /usr/include/cppconn/driver.h:30,
from /usr/include/mysql_driver.h:32,
from src/test_mariadb.cpp:3:
/usr/include/boost/mpl/aux_/has_tag.hpp:20:54: error: macro "test" passed 2 arguments, but takes just 1
BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF(has_tag, tag, false)
^
In file included from /usr/include/boost/mpl/aux_/O1_size_impl.hpp:20:0,
from /usr/include/boost/mpl/O1_size.hpp:19,
from /usr/include/boost/mpl/iter_fold.hpp:19,
from /usr/include/boost/variant/detail/initializer.hpp:28,
from /usr/include/boost/variant/variant.hpp:31,
from /usr/include/boost/variant.hpp:17,
from /usr/include/cppconn/connection.h:31,
from /usr/include/cppconn/driver.h:30,
from /usr/include/mysql_driver.h:32,
from src/test_mariadb.cpp:3:
/usr/include/boost/mpl/aux_/has_size.hpp:20:1: error: macro "test" passed 2 arguments, but takes just 1
BOOST_MPL_HAS_XXX_TRAIT_DEF(size)
^
In file included from /usr/include/boost/mpl/apply_wrap.hpp:23:0,
from /usr/include/boost/mpl/bind.hpp:27,
from /usr/include/boost/mpl/lambda.hpp:18,
from /usr/include/boost/mpl/iter_fold.hpp:20,
from /usr/include/boost/variant/detail/initializer.hpp:28,
from /usr/include/boost/variant/variant.hpp:31,
from /usr/include/boost/variant.hpp:17,
from /usr/include/cppconn/connection.h:31,
from /usr/include/cppconn/driver.h:30,
from /usr/include/mysql_driver.h:32,
from src/test_mariadb.cpp:3:
/usr/include/boost/mpl/aux_/has_apply.hpp:22:58: error: macro "test" passed 2 arguments, but takes just 1
BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF(has_apply, apply, false)
^
In file included from /usr/include/boost/mpl/quote.hpp:23:0,
from /usr/include/boost/mpl/aux_/full_lambda.hpp:25,
from /usr/include/boost/mpl/lambda.hpp:22,
from /usr/include/boost/mpl/iter_fold.hpp:20,
from /usr/include/boost/variant/detail/initializer.hpp:28,
from /usr/include/boost/variant/variant.hpp:31,
from /usr/include/boost/variant.hpp:17,
from /usr/include/cppconn/connection.h:31,
from /usr/include/cppconn/driver.h:30,
from /usr/include/mysql_driver.h:32,
from src/test_mariadb.cpp:3:
/usr/include/boost/mpl/aux_/has_type.hpp:20:55: error: macro "test" passed 2 arguments, but takes just 1
BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF(has_type, type, true)
^
In file included from src/test_mariadb.cpp:1:0:
/usr/include/c++/4.8/bits/stl_algobase.h:193:5: error: expected unqualified-id before ‘const’
min(const _Tp& __a, const _Tp& __b)
^
/usr/include/c++/4.8/bits/stl_algobase.h:193:5: error: expected ‘)’ before ‘const’
/usr/include/c++/4.8/bits/stl_algobase.h:193:5: error: expected ‘)’ before ‘const’
/usr/include/c++/4.8/bits/stl_algobase.h:193:5: error: expected initializer before ‘const’
/usr/include/c++/4.8/bits/stl_algobase.h:216:5: error: expected unqualified-id before ‘const’
max(const _Tp& __a, const _Tp& __b)
^
/usr/include/c++/4.8/bits/stl_algobase.h:216:5: error: expected ‘)’ before ‘const’
/usr/include/c++/4.8/bits/stl_algobase.h:216:5: error: expected ‘)’ before ‘const’
/usr/include/c++/4.8/bits/stl_algobase.h:216:5: error: expected initializer before ‘const’
In file included from /usr/include/c++/4.8/bits/char_traits.h:39:0,
from /usr/include/c++/4.8/ios:40,
from /usr/include/c++/4.8/ostream:38,
from /usr/include/c++/4.8/iostream:39,
from /usr/include/boost/assert.hpp:82,
from /usr/include/boost/smart_ptr/scoped_ptr.hpp:15,
from /usr/include/boost/scoped_ptr.hpp:14,
from /usr/include/mysql_driver.h:30,
from src/test_mariadb.cpp:3:
/usr/include/c++/4.8/bits/stl_algobase.h:239:5: error: ‘std::min’ declared as an ‘inline’ variable
min(const _Tp& __a, const _Tp& __b, _Compare __comp)
^
/usr/include/c++/4.8/bits/stl_algobase.h:239:5: error: template declaration of ‘const _Tp& std::min’
/usr/include/c++/4.8/bits/stl_algobase.h:242:7: error: expected primary-expression before ‘if’
if (__comp(__b, __a))
^
/usr/include/c++/4.8/bits/stl_algobase.h:242:7: error: expected ‘}’ before ‘if’
/usr/include/c++/4.8/bits/stl_algobase.h:244:7: error: expected unqualified-id before ‘return’
return __a;
^
/usr/include/c++/4.8/bits/stl_algobase.h:260:5: error: ‘max’ declared as an ‘inline’ variable
max(const _Tp& __a, const _Tp& __b, _Compare __comp)
^
/usr/include/c++/4.8/bits/stl_algobase.h:260:5: error: template declaration of ‘const _Tp& max’
/usr/include/c++/4.8/bits/stl_algobase.h:263:7: error: expected primary-expression before ‘if’
if (__comp(__a, __b))
^
/usr/include/c++/4.8/bits/stl_algobase.h:263:7: error: expected ‘}’ before ‘if’
/usr/include/c++/4.8/bits/stl_algobase.h:265:7: error: expected unqualified-id before ‘return’
return __a;
^
/usr/include/c++/4.8/bits/stl_algobase.h:266:5: error: expected declaration before ‘}’ token
}
A header you have included has defined preprocessor macros named min, max and test. These have then conflicted with identifiers used (e.g. for method names) in other header files you have included.
Assuming that those macros have been defined in one of these headers:
#include <my_global.h>
#include <mysql.h>
you could add #undefs before you include mysql_driver.h, e.g.:
#include <my_global.h>
#include <mysql.h>
#undef min
#undef max
#undef test
#include "mysql_driver.h"
You could also consider re-arranging the order in which you include the files, or look into what headers are defining these and see whether the definition of these macros can be disabled.