Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build error #1415

Closed
MaximusPro opened this issue Jan 6, 2019 · 13 comments
Closed

Build error #1415

MaximusPro opened this issue Jan 6, 2019 · 13 comments
Labels
platform: mingw related to MinGW

Comments

@MaximusPro
Copy link

Hello, I have a problam with make library in mingw.
How can I solve this error?

make check
make check -C test
make[1]: Entering directory `C:/Users/Max/Documents/libscpp/json/test'
[CXX]   src/unit.o
In file included from c:\mingw\lib\gcc\mingw32\8.2.0\include\c++\cstdio:42,
                 from c:\mingw\lib\gcc\mingw32\8.2.0\include\c++\ext\string_conversions.h:43,
                 from c:\mingw\lib\gcc\mingw32\8.2.0\include\c++\bits\basic_string.h:6391,
                 from c:\mingw\lib\gcc\mingw32\8.2.0\include\c++\string:52,
                 from c:\mingw\lib\gcc\mingw32\8.2.0\include\c++\bits\locale_classes.h:40,
                 from c:\mingw\lib\gcc\mingw32\8.2.0\include\c++\bits\ios_base.h:41,
                 from c:\mingw\lib\gcc\mingw32\8.2.0\include\c++\ios:42,
                 from c:\mingw\lib\gcc\mingw32\8.2.0\include\c++\istream:38,
                 from c:\mingw\lib\gcc\mingw32\8.2.0\include\c++\sstream:38,
                 from thirdparty/catch/catch.hpp:384,
                 from src/unit.cpp:31:
c:\mingw\include\stdio.h:788:34: error: '__off64_t' does not name a type; did you mean '__time64_t'?
 typedef union { __int64 __value; __off64_t __offset; } fpos_t;
                                  ^~~~~~~~~
                                  __time64_t
make[1]: *** [src/unit.o] Ошибка 1
make[1]: Leaving directory `C:/Users/Max/Documents/libscpp/json/test'
make: *** [check] Ошибка 2
@nlohmann nlohmann added the platform: mingw related to MinGW label Jan 6, 2019
@MaximusPro
Copy link
Author

MaximusPro commented Jan 6, 2019

I fined in types.h what this:
typedef __int64 __off64_t;
I replaced on __int64 but i have this errors:

make check
make check -C test
make[1]: Entering directory `C:/Users/Max/Documents/libscpp/json/test'
"[CXX]   src/unit-algorithms.o"
In file included from src/unit-algorithms.cpp:32:
../single_include/nlohmann/json.hpp: In static member function 'static std::__cxx11::string nlohmann::detail::exception::name(const string&, int)':
../single_include/nlohmann/json.hpp:885:56: error: 'to_string' is not a member of 'std'
         return "[json.exception." + ename + "." + std::to_string(id_) + "] ";
                                                        ^~~~~~~~~
In file included from src/unit-algorithms.cpp:32:
../single_include/nlohmann/json.hpp: In static member function 'static nlohmann::detail::parse_error nlohmann::detail::parse_error::create(int, std::size_t, const string&)':
../single_include/nlohmann/json.hpp:959:59: error: 'to_string' is not a member of 'std'
                         (byte_ != 0 ? (" at byte " + std::to_string(byte_)) : "") +
                                                           ^~~~~~~~~
../single_include/nlohmann/json.hpp: In static member function 'static std::__cxx11::string nlohmann::detail::parse_error::position_string(const nlohmann::detail::position_t&)':
../single_include/nlohmann/json.hpp:981:35: error: 'to_string' is not a member of 'std'
         return " at line " + std::to_string(pos.lines_read + 1) +
                                   ^~~~~~~~~
../single_include/nlohmann/json.hpp:982:35: error: 'to_string' is not a member of 'std'
                ", column " + std::to_string(pos.chars_read_current_line);
                                   ^~~~~~~~~
In file included from src/unit-algorithms.cpp:32:
../single_include/nlohmann/json.hpp: In member function 'const string& nlohmann::detail::iteration_proxy_value<IteratorType>::key() const':
../single_include/nlohmann/json.hpp:1726:44: error: 'to_string' is not a member of 'std'
                     array_index_str = std::to_string(array_index);
                                            ^~~~~~~~~
In file included from src/unit-algorithms.cpp:32:
../single_include/nlohmann/json.hpp: In member function 'std::__cxx11::string nlohmann::detail::lexer<BasicJsonType>::get_token_string() const':
../single_include/nlohmann/json.hpp:3930:23: error: 'snprintf' is not a member of 'std'
                 (std::snprintf)(cs, 9, "<U+%.4X>", static_cast<unsigned char>(c));
                       ^~~~~~~~
../single_include/nlohmann/json.hpp:3930:23: note: suggested alternative: 'isprint'
                 (std::snprintf)(cs, 9, "<U+%.4X>", static_cast<unsigned char>(c));
                       ^~~~~~~~
                       isprint

@nlohmann
Copy link
Owner

nlohmann commented Jan 6, 2019

The to_string issue is a known problem with MinGW, see https://github.com/nlohmann/json#supported-compilers.

@MaximusPro
Copy link
Author

MaximusPro commented Jan 6, 2019

I have version compiler 8.20, its not compile with version 4.7.0.
Do you have modified source files for 8.2.0?

@nlohmann
Copy link
Owner

nlohmann commented Jan 6, 2019

This is still an error in MinGW, because std:: to_string should be part of the compiler's standard library. The same holds for std::snprintf.

@MaximusPro
Copy link
Author

I know this. I replaced files but its not compile. I use mingw g++ 4.7.0 and replaced files for std::to_string but its don't gave resault.
Resault:

make check
make check -C test
make[1]: Entering directory `C:/projects/json/test'
"[CXX]   src/unit-algorithms.o"
In file included from src/unit-algorithms.cpp:32:0:
../single_include/nlohmann/json.hpp:129:14: error: #error "unsupported GCC version - see https://github.com/nlohmann/json#supported-compilers"
In file included from src/unit-algorithms.cpp:32:0:
../single_include/nlohmann/json.hpp: In static member function 'static std::string nlohmann::detail::exception::name(const string&, int)':
../single_include/nlohmann/json.hpp:885:51: error: 'to_string' is not a member of 'std'
In file included from src/unit-algorithms.cpp:32:0:
../single_include/nlohmann/json.hpp: In static member function 'static nlohmann::detail::parse_error nlohmann::detail::parse_error::create(int, std::size_t, const string&)':
../single_include/nlohmann/json.hpp:959:54: error: 'to_string' is not a member of 'std'
../single_include/nlohmann/json.hpp: In static member function 'static std::string nlohmann::detail::parse_error::position_string(const nlohmann::detail::position_t&)':
../single_include/nlohmann/json.hpp:981:30: error: 'to_string' is not a member of 'std'
../single_include/nlohmann/json.hpp:982:30: error: 'to_string' is not a member of 'std'
In file included from src/unit-algorithms.cpp:32:0:
../single_include/nlohmann/json.hpp: In member function 'const string& nlohmann::detail::iteration_proxy_value<IteratorType>::key() const':
../single_include/nlohmann/json.hpp:1726:39: error: 'to_string' is not a member of 'std'
../single_include/nlohmann/json.hpp: At global scope:
../single_include/nlohmann/json.hpp:1799:17: error: '<::' cannot begin a template-argument list [-fpermissive]
../single_include/nlohmann/json.hpp:1799:17: note: '<:' is an alternate spelling for '['. Insert whitespace between '<' and '::'
../single_include/nlohmann/json.hpp:1799:17: note: (if you use '-fpermissive' G++ will accept your code)
In file included from src/unit-algorithms.cpp:32:0:
../single_include/nlohmann/json.hpp:2097:55: error: wrong number of template arguments (1, should be 2)
In file included from c:\mingw\bin\../lib/gcc/x86_64-w64-mingw32/4.7.0/../../../../include/c++/4.7.0/bits/stl_algobase.h:65:0,
                 from c:\mingw\bin\../lib/gcc/x86_64-w64-mingw32/4.7.0/../../../../include/c++/4.7.0/bits/char_traits.h:41,
                 from c:\mingw\bin\../lib/gcc/x86_64-w64-mingw32/4.7.0/../../../../include/c++/4.7.0/ios:41,
                 from c:\mingw\bin\../lib/gcc/x86_64-w64-mingw32/4.7.0/../../../../include/c++/4.7.0/istream:40,
                 from c:\mingw\bin\../lib/gcc/x86_64-w64-mingw32/4.7.0/../../../../include/c++/4.7.0/sstream:39,
                 from thirdparty/catch/catch.hpp:384,
                 from src/unit-algorithms.cpp:30:
c:\mingw\bin\../lib/gcc/x86_64-w64-mingw32/4.7.0/../../../../include/c++/4.7.0/bits/stl_pair.h:88:12: error: provided for 'template<class _T1, class _T2> struct std::pair'
In file included from src/unit-algorithms.cpp:32:0:
../single_include/nlohmann/json.hpp: In function 'void nlohmann::detail::to_json(BasicJsonType&, const int&)':
../single_include/nlohmann/json.hpp:2099:13: error: request for member 'first' in 'p', which is of non-class type 'const int'
../single_include/nlohmann/json.hpp:2099:22: error: request for member 'second' in 'p', which is of non-class type 'const int'
In file included from src/unit-algorithms.cpp:32:0:
../single_include/nlohmann/json.hpp: At global scope:
../single_include/nlohmann/json.hpp:2223:5: error: looser throw specifier for 'virtual nlohmann::detail::input_stream_adapter::~input_stream_adapter()'
../single_include/nlohmann/json.hpp:2184:13: error:   overriding 'virtual nlohmann::detail::input_adapter_protocol::~input_adapter_protocol() noexcept (true)'
../single_include/nlohmann/json.hpp:2273:5: error: looser throw specifier for 'virtual nlohmann::detail::input_buffer_adapter::~input_buffer_adapter()'
../single_include/nlohmann/json.hpp:2184:13: error:   overriding 'virtual nlohmann::detail::input_adapter_protocol::~input_adapter_protocol() noexcept (true)'
In file included from src/unit-algorithms.cpp:32:0:
../single_include/nlohmann/json.hpp: In member function 'bool nlohmann::detail::json_sax_dom_parser<BasicJsonType>::start_object(std::size_t)':
../single_include/nlohmann/json.hpp:4440:13: error: 'to_string' is not a member of 'std'
../single_include/nlohmann/json.hpp: In member function 'bool nlohmann::detail::json_sax_dom_parser<BasicJsonType>::start_array(std::size_t)':
../single_include/nlohmann/json.hpp:4466:13: error: 'to_string' is not a member of 'std'
../single_include/nlohmann/json.hpp: In member function 'bool nlohmann::detail::json_sax_dom_callback_parser<BasicJsonType>::start_object(std::size_t)':
../single_include/nlohmann/json.hpp:4624:17: error: 'to_string' is not a member of 'std'
../single_include/nlohmann/json.hpp: In member function 'bool nlohmann::detail::json_sax_dom_callback_parser<BasicJsonType>::start_array(std::size_t)':
../single_include/nlohmann/json.hpp:4697:17: error: 'to_string' is not a member of 'std'
In file included from src/unit-algorithms.cpp:32:0:
../single_include/nlohmann/json.hpp: In member function 'bool nlohmann::detail::binary_reader<BasicJsonType, SAX>::get_bson_string(NumberType, nlohmann::detail::binary_reader<BasicJsonType, SAX>::string_t&)':
../single_include/nlohmann/json.hpp:6651:180: error: 'to_string' is not a member of 'std'
In file included from src/unit-algorithms.cpp:32:0:
../single_include/nlohmann/json.hpp: In static member function 'static std::size_t nlohmann::detail::binary_writer<BasicJsonType, CharType>::calc_bson_entry_header_size(const string_t&)':
../single_include/nlohmann/json.hpp:9159:13: error: 'to_string' is not a member of 'std'
../single_include/nlohmann/json.hpp: In member function 'void nlohmann::detail::binary_writer<BasicJsonType, CharType>::write_bson_unsigned(const string_t&, uint64_t)':
../single_include/nlohmann/json.hpp:9289:13: error: 'to_string' is not a member of 'std'
../single_include/nlohmann/json.hpp: In static member function 'static std::size_t nlohmann::detail::binary_writer<BasicJsonType, CharType>::calc_bson_array_size(const typename BasicJsonType::array_t&)':
../single_include/nlohmann/json.hpp:9313:62: error: 'to_string' is not a member of 'std'
../single_include/nlohmann/json.hpp: In member function 'void nlohmann::detail::binary_writer<BasicJsonType, CharType>::write_bson_array(const string_t&, const typename BasicJsonType::array_t&)':
../single_include/nlohmann/json.hpp:9332:32: error: 'to_string' is not a member of 'std'
../single_include/nlohmann/json.hpp: In member function 'void nlohmann::detail::binary_writer<BasicJsonType, CharType>::write_number_with_ubjson_prefix(NumberType, bool)':
../single_include/nlohmann/json.hpp:9550:13: error: 'to_string' is not a member of 'std'
../single_include/nlohmann/json.hpp: In member function 'void nlohmann::detail::binary_writer<BasicJsonType, CharType>::write_number_with_ubjson_prefix(NumberType, bool)':
../single_include/nlohmann/json.hpp:9604:13: error: 'to_string' is not a member of 'std'
In file included from src/unit-algorithms.cpp:32:0:
../single_include/nlohmann/json.hpp: In member function 'void nlohmann::detail::serializer<BasicJsonType>::dump_escaped(const string_t&, bool)':
../single_include/nlohmann/json.hpp:11303:29: error: 'to_string' is not a member of 'std'
In file included from src/unit-algorithms.cpp:32:0:
../single_include/nlohmann/json.hpp: In static member function 'static int nlohmann::json_pointer<BasicJsonType>::array_index(const string&)':
../single_include/nlohmann/json.hpp:11789:25: error: 'stoi' is not a member of 'std'
In file included from src/unit-algorithms.cpp:32:0:
../single_include/nlohmann/json.hpp: In member function 'BasicJsonType& nlohmann::json_pointer<BasicJsonType>::get_checked(BasicJsonType*) const':
../single_include/nlohmann/json.hpp:12018:25: error: 'to_string' is not a member of 'std'
../single_include/nlohmann/json.hpp: In member function 'const BasicJsonType& nlohmann::json_pointer<BasicJsonType>::get_unchecked(const BasicJsonType*) const':
../single_include/nlohmann/json.hpp:12083:25: error: 'to_string' is not a member of 'std'
../single_include/nlohmann/json.hpp: In member function 'const BasicJsonType& nlohmann::json_pointer<BasicJsonType>::get_checked(const BasicJsonType*) const':
../single_include/nlohmann/json.hpp:12142:25: error: 'to_string' is not a member of 'std'
../single_include/nlohmann/json.hpp: In static member function 'static void nlohmann::json_pointer<BasicJsonType>::flatten(const string&, const BasicJsonType&, BasicJsonType&)':
../single_include/nlohmann/json.hpp:12310:58: error: 'to_string' is not a member of 'std'
In file included from src/unit-algorithms.cpp:32:0:
../single_include/nlohmann/json.hpp: In static member function 'static nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer> nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer>::meta()':
../single_include/nlohmann/json.hpp:12708:13: error: 'to_string' is not a member of 'std'
../single_include/nlohmann/json.hpp:12709:13: error: 'to_string' is not a member of 'std'
../single_include/nlohmann/json.hpp:12710:13: error: 'to_string' is not a member of 'std'
../single_include/nlohmann/json.hpp:12732:62: error: 'to_string' is not a member of 'std'
../single_include/nlohmann/json.hpp:12732:95: error: 'to_string' is not a member of 'std'
../single_include/nlohmann/json.hpp:12732:134: error: 'to_string' is not a member of 'std'
../single_include/nlohmann/json.hpp:12748:37: error: 'to_string' is not a member of 'std'
../single_include/nlohmann/json.hpp: In member function 'nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer>::value_type& nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer>::at(nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer>::size_type)':
../single_include/nlohmann/json.hpp:15300:17: error: 'to_string' is not a member of 'std'
../single_include/nlohmann/json.hpp: In member function 'const value_type& nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer>::at(nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer>::size_type) const':
../single_include/nlohmann/json.hpp:15347:17: error: 'to_string' is not a member of 'std'
../single_include/nlohmann/json.hpp: In member function 'void nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer>::erase(nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer>::size_type)':
../single_include/nlohmann/json.hpp:16236:17: error: 'to_string' is not a member of 'std'
../single_include/nlohmann/json.hpp: In lambda function:
../single_include/nlohmann/json.hpp:19865:33: error: 'to_string' is not a member of 'std'
../single_include/nlohmann/json.hpp: In static member function 'static nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer> nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer>::diff(const nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer>&, const nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer>&, const string&)':
../single_include/nlohmann/json.hpp:20112:82: error: 'to_string' is not a member of 'std'
../single_include/nlohmann/json.hpp:20129:51: error: 'to_string' is not a member of 'std'
../single_include/nlohmann/json.hpp:20140:51: error: 'to_string' is not a member of 'std'
../single_include/nlohmann/json.hpp:436: confused by earlier errors, bailing out
make[1]: *** [src/unit-algorithms.o] Ошибка 1
make[1]: Leaving directory `C:/projects/json/test'
make: *** [check] Ошибка 2

@nlohmann
Copy link
Owner

nlohmann commented Jan 7, 2019

This seems to be a MinGW error. Note the library compiles without problems with mingw-w64/x86_64-7.3.0-posix-seh-rt_v5-rev0 - see https://ci.appveyor.com/project/nlohmann/json/build/job/lp1n8keph3u49w5j

@MaximusPro
Copy link
Author

Error:

cmake . -G "%GENERATOR%" -DCMAKE_CXX_FLAGS="%FLAGS%" -DCMAKE_IGNORE_PATH="C:/Program Files/Git/usr/bin"
-- The CXX compiler identification is GNU 7.3.0
-- Check for working CXX compiler: C:/MinGW/bin/c++.exe
-- Check for working CXX compiler: C:/MinGW/bin/c++.exe -- broken
CMake Error at C:/Program Files/CMake/share/cmake-3.13/Modules/CMakeTestCXXCompiler.cmake:45 (message):
  The C++ compiler

    "C:/MinGW/bin/c++.exe"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: C:/projects/json/CMakeFiles/CMakeTmp

    Run Build Command:"C:/projects/deps/ninja/ninja.exe" "cmTC_8fbe3"
    [1/2] Building CXX object CMakeFiles/cmTC_8fbe3.dir/testCXXCompiler.cxx.obj
    FAILED: C:\MinGW\bin\c++.exe    %FLAGS% -o CMakeFiles/cmTC_8fbe3.dir/testCXXCompiler.cxx.obj -c testCXXCompiler.cxx
    c++.exe: error: %FLAGS%: No such file or directory
    ninja: build stopped: subcommand failed.




  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:7 (project)


-- Configuring incomplete, errors occurred!
See also "C:/projects/json/CMakeFiles/CMakeOutput.log".
See also "C:/projects/json/CMakeFiles/CMakeError.log".

What do this parameter "%FLAGS%" ??

@nlohmann
Copy link
Owner

@MaximusPro
Copy link
Author

MaximusPro commented Jan 11, 2019

I tried.
I have a mistake again:

C:\projects\json>cmake . -G "%GENERATOR%" -DCMAKE_CXX_FLAGS="  -DCMAKE_IGNORE_PATH="C:/Program Files/Git/usr/bin"
CMake Error: The source directory "C:/projects/json/Files/Git/usr/bin" does not exist.
Specify --help for usage, or press the help button on the CMake GUI.

@nlohmann
Copy link
Owner

You may not need to set all the variables - these are just for AppVeyor's setup.

@MaximusPro
Copy link
Author

Oops, I made mistake. I need delete symbol "
Use this command:
C:\projects\json>cmake . -G "%GENERATOR%" -DCMAKE_CXX_FLAGS= -DCMAKE_IGNORE_PATH="C:/Program Files/Git/usr/bin"

@nlohmann
Copy link
Owner

Does it work now?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform: mingw related to MinGW
Projects
None yet
Development

No branches or pull requests

2 participants