win7下g++ std=c++11特性测试

本文介绍了如何选择适合的C++编译器,并使用C++11标准进行多线程编程。通过具体示例展示了如何创建并运行多线程程序,包括编译步骤及运行结果。

1 g++编译器的选择


    有多个版本的C++编译器,包括:mingw,tdm-mingw等,但版本相对更新慢或者未提供openmp、thread库。

    经测试,选择http://code.google.com/p/mingw-builds/下的编译器,下载链接:http://mingw-builds.googlecode.com/files/x86_64-mingw32-gcc-4.7.0-release-c%2Cc%2B%2B%2Cfortran-sjlj.zip

    解压缩到d:下。

2 测试程序

#include <thread>
#include <iostream>
#include <vector>

void hello(){
    std::cout << "Hello from thread " << std::this_thread::get_id() << std::endl;
}

int main(){
    std::vector<std::thread> threads;

    for(int i = 0; i < 5; ++i){
        threads.push_back(std::thread(hello));
    }
	
	for(auto& thread : threads){
        thread.join();
    }

    return 0;	
}


3 编译

g++ -std=c++11 test.cpp

 

4 结果

Hello from thread Hello from thread 6Hello from thread 5Hello from thread 3


2Hello from thread
4

测试通过!

 

35 0 C:\Program Files (x86)\Dev-Cpp\MinGW64\lib\gcc\x86_64-w64-mingw32\4.9.2\include\c++\array In file included from C:/Program Files (x86)/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/4.9.2/include/c++/array 2 D:\范铭博编程文件\特殊\牛逼的东西.cpp from D:\范铭博编程文件\特殊\牛逼的东西.cpp 32 2 C:\Program Files (x86)\Dev-Cpp\MinGW64\lib\gcc\x86_64-w64-mingw32\4.9.2\include\c++\bits\c++0x_warning.h [Error] #error This file requires compiler and library support for the ISO C++ 2011 standard. This support is currently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 compiler options. 8 1 D:\范铭博编程文件\特殊\牛逼的东西.cpp [Error] 'constexpr' does not name a type 8 1 D:\范铭博编程文件\特殊\牛逼的东西.cpp [Note] C++11 'constexpr' only available with -std=c++11 or -std=gnu++11 D:\范铭博编程文件\特殊\牛逼的东西.cpp In function 'int main()': 26 5 D:\范铭博编程文件\特殊\牛逼的东西.cpp [Error] 'constexpr' was not declared in this scope 30 14 D:\范铭博编程文件\特殊\牛逼的东西.cpp [Error] 'function' in namespace 'std' does not name a template type 31 30 D:\范铭博编程文件\特殊\牛逼的东西.cpp [Error] expected ')' before '<' token D:\范铭博编程文件\特殊\牛逼的东西.cpp In destructor 'main()::Printer::~Printer()': 32 29 D:\范铭博编程文件\特殊\牛逼的东西.cpp [Error] 'action' was not declared in this scope D:\范铭博编程文件\特殊\牛逼的东西.cpp In lambda function: 39 35 D:\范铭博编程文件\特殊\牛逼的东西.cpp [Warning] extended initializer lists only available with -std=c++11 or -std=gnu++11 D:\范铭博编程文件\特殊\牛逼的东西.cpp In function 'int main()': 42 5 D:\范铭博编程文件\特殊\牛逼的东西.cpp [Warning] lambda expressions only available with -std=c++11 or -std=gnu++11 42 6 D:\范铭博编程文件\特殊\牛逼的东西.cpp [Error] no matching function for call to 'main()::Printer::Printer(main()::<lambda()>)' 42 6 D:\范铭博编程文件\特殊\牛逼的东西.cpp [Note] candidates are: 29 12 D:\范铭博编程文件\特殊\牛逼的东西.cpp [Note] main()::Printer::Printer() 29 12 D:\范铭博编程文件\特殊\牛逼的东西.cpp [Note] candidate expects 0 arguments, 1 provided 29 12 D:\范铭博编程文件\特殊\牛逼的东西.cpp [Note] main()::Printer::Printer(const main()::Printer&) 29 12 D:\范铭博编程文件\特殊\牛逼的东西.cpp [Note] no known conversion for argument 1 from 'main()::<lambda()>' to 'const main()::Printer&' 45 7 D:\范铭博编程文件\特殊\牛逼的东西.cpp [Error] 'struct main()::Printer' has no member named 'action' 48 16 D:\范铭博编程文件\特殊\牛逼的东西.cpp [Warning] variadic templates only available with -std=c++11 or -std=gnu++11 48 16 D:\范铭博编程文件\特殊\牛逼的东西.cpp [Error] expansion pattern 'int' contains no argument packs D:\范铭博编程文件\特殊\牛逼的东西.cpp In lambda function: 49 9 D:\范铭博编程文件\特殊\牛逼的东西.cpp [Error] 'array' is not a member of 'std' 50 19 D:\范铭博编程文件\特殊\牛逼的东西.cpp [Error] 'arr' was not declared in this scope 52 19 D:\范铭博编程文件\特殊\牛逼的东西.cpp [Error] 'x' does not name a type 53 9 D:\范铭博编程文件\特殊\牛逼的东西.cpp [Error] expected ';' before 'std' 54 5 D:\范铭博编程文件\特殊\牛逼的东西.cpp [Error] expected primary-expression before '}' token 54 5 D:\范铭博编程文件\特殊\牛逼的东西.cpp [Error] expected ')' before '}' token 54 5 D:\范铭博编程文件\特殊\牛逼的东西.cpp [Error] expected primary-expression before '}' token D:\范铭博编程文件\特殊\牛逼的东西.cpp In function 'int main()': 54 5 D:\范铭博编程文件\特殊\牛逼的东西.cpp [Warning] lambda expressions only available with -std=c++11 or -std=gnu++11 54 20 D:\范铭博编程文件\特殊\牛逼的东西.cpp [Error] no match for call to '(main()::<lambda()>) (int, int, int, int, int)' 48 6 D:\范铭博编程文件\特殊\牛逼的东西.cpp [Note] candidates are: 54 20 D:\范铭博编程文件\特殊\牛逼的东西.cpp [Note] void (*)() <conversion> 54 20 D:\范铭博编程文件\特殊\牛逼的东西.cpp [Note] candidate expects 1 argument, 6 provided 48 17 D:\范铭博编程文件\特殊\牛逼的东西.cpp [Note] main()::<lambda()> 48 17 D:\范铭博编程文件\特殊\牛逼的东西.cpp [Note] candidate expects 0 arguments, 5 provided
最新发布
10-05
. ├── config.ini ├── demo2example ├── loglib │   ├── ccdeclare.h │   ├── cclog.h │   └── ccsingleton.h ├── makefile ├── source │   ├── getconfig.cpp │   ├── getconfig.h │   ├── subtitdspi.cpp │   ├── subtitdspi.h │   ├── testtitdapi.cpp │   ├── titdapi_req.cpp │   ├── titdapi_req.h │   ├── user.cpp │   ├── user.h │   ├── user_input.cpp │   ├── user_other.cpp │   └── user_prog.cpp ├── spdlog │   └── v1.9.2 │   └── include │   └── spdlog │   ├── async.h │   ├── async_logger.h │   ├── async_logger-inl.h │   ├── cfg │   │   ├── argv.h │   │   ├── env.h │   │   ├── helpers.h │   │   └── helpers-inl.h │   ├── common.h │   ├── common-inl.h │   ├── details │   │   ├── backtracer.h │   │   ├── backtracer-inl.h │   │   ├── circular_q.h │   │   ├── console_globals.h │   │   ├── file_helper.h │   │   ├── file_helper-inl.h │   │   ├── fmt_helper.h │   │   ├── log_msg_buffer.h │   │   ├── log_msg_buffer-inl.h │   │   ├── log_msg.h │   │   ├── log_msg-inl.h │   │   ├── mpmc_blocking_q.h │   │   ├── null_mutex.h │   │   ├── os.h │   │   ├── os-inl.h │   │   ├── periodic_worker.h │   │   ├── periodic_worker-inl.h │   │   ├── registry.h │   │   ├── registry-inl.h │   │   ├── synchronous_factory.h │   │   ├── tcp_client.h │   │   ├── tcp_client-windows.h │   │   ├── thread_pool.h │   │   ├── thread_pool-inl.h │   │   ├── udp_client.h │   │   ├── udp_client-windows.h │   │   └── windows_include.h │   ├── fmt │   │   ├── bin_to_hex.h │   │   ├── bundled │   │   │   ├── args.h │   │   │   ├── chrono.h │   │   │   ├── color.h │   │   │   ├── compile.h │   │   │   ├── core.h │   │   │   ├── fmt.license.rst │   │   │   ├── format.h │   │   │   ├── format-inl.h │   │   │   ├── locale.h │   │   │   ├── os.h │   │   │   ├── ostream.h │   │   │   ├── printf.h │   │   │   ├── ranges.h │   │   │   └── xchar.h │   │   ├── chrono.h │   │   ├── compile.h │   │   ├── fmt.h │   │   ├── ostr.h │   │   ├── ranges.h │   │   └── xchar.h │   ├── formatter.h │   ├── fwd.h │   ├── logger.h │   ├── logger-inl.h │   ├── pattern_formatter.h │   ├── pattern_formatter-inl.h │   ├── sinks │   │   ├── android_sink.h │   │   ├── ansicolor_sink.h │   │   ├── ansicolor_sink-inl.h │   │   ├── base_sink.h │   │   ├── base_sink-inl.h │   │   ├── basic_file_sink.h │   │   ├── basic_file_sink-inl.h │   │   ├── daily_file_sink.h │   │   ├── dist_sink.h │   │   ├── dup_filter_sink.h │   │   ├── hourly_file_sink.h │   │   ├── mongo_sink.h │   │   ├── msvc_sink.h │   │   ├── null_sink.h │   │   ├── ostream_sink.h │   │   ├── qt_sinks.h │   │   ├── ringbuffer_sink.h │   │   ├── rotating_file_sink.h │   │   ├── rotating_file_sink-inl.h │   │   ├── sink.h │   │   ├── sink-inl.h │   │   ├── stdout_color_sinks.h │   │   ├── stdout_color_sinks-inl.h │   │   ├── stdout_sinks.h │   │   ├── stdout_sinks-inl.h │   │   ├── syslog_sink.h │   │   ├── systemd_sink.h │   │   ├── tcp_sink.h │   │   ├── udp_sink.h │   │   ├── wincolor_sink.h │   │   ├── wincolor_sink-inl.h │   │   └── win_eventlog_sink.h │   ├── spdlog.h │   ├── spdlog-inl.h │   ├── stopwatch.h │   ├── tweakme.h │   └── version.h └── userconfig.ini 这是demo2的树形结构,makefile文件如下:#获取.cpp文件 SrcFiles=$(wildcard source/*.cpp spdlog/*.cpp) #使用替换函数获取.o文件 ObjFiles=$(patsubst %.cpp,%.o,$(SrcFiles)) #生成的可执行文件 all:tiexample #目标文件依赖于.o文件 tiexample:$(ObjFiles) g++ -o $@ -I ../../lib -I ./spdlog/v1.9.2/include -I ./loglib -I ./source $(SrcFiles) -Wl,-rpath=../../lib -L ../../lib -l titdapi -lpthread #.o文件依赖于.cpp文件,通配使用,一条就够 %.o:%.cpp g++ -c -I ../../lib -I ./spdlog/v1.9.2/include -I ./loglib -I ./source $< rm *.o ,在demo2目录下输入make,得到的警告信息如下:./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:298:32: 错误:在文件层将‘is_big_endian’声明为‘auto’ inline auto is_big_endian() -> bool { ^ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:298:32: 错误:trailing return type only available with -std=c++11 or -std=gnu++11 In file included from ./spdlog/v1.9.2/include/spdlog/fmt/bundled/core.h:3234:0, from ./spdlog/v1.9.2/include/spdlog/fmt/fmt.h:24, from ./spdlog/v1.9.2/include/spdlog/common.h:45, from ./spdlog/v1.9.2/include/spdlog/spdlog.h:12, from ./loglib/cclog.h:8, from ./loglib/ccdeclare.h:7, from source/subtitdspi.h:8, from source/user.h:4, from source/user_prog.cpp:1: ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:317:24: 警告:defaulted and deleted functions only available with -std=c++11 or -std=gnu++11 [默认启用] fallback_uintptr() = default; ^ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h: 在构造函数‘fmt::v8::detail::fallback_uintptr::fallback_uintptr(const void*)’中: ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:319:13: 错误:‘bit_cast’在此作用域中尚未声明 *this = bit_cast<fallback_uintptr>(p); ^ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:319:38: 错误:expected primary-expression before ‘>’ token *this = bit_cast<fallback_uintptr>(p); ^ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:320:35: 错误:‘is_big_endian’在此作用域中尚未声明 if (const_check(is_big_endian())) { ^ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:320:36: 错误:‘const_check’在此作用域中尚未声明 if (const_check(is_big_endian())) { ^ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h: 在全局域: ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:327:7: 错误:expected nested-name-specifier before ‘uintptr_t’ using uintptr_t = ::uintptr_t; ^ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:327:17: 错误:expected ‘;’ before ‘=’ token using uintptr_t = ::uintptr_t; ^ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:327:17: 错误:expected unqualified-id before ‘=’ token ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:328:42: 错误:ISO C++ 不允许声明无类型的‘to_uintptr’ [-fpermissive] inline auto to_uintptr(const void* p) -> uintptr_t { ^ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:328:42: 错误:在文件层将‘to_uintptr’声明为‘auto’ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:328:42: 错误:trailing return type only available with -std=c++11 or -std=gnu++11 ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:340:23: 错误:‘constexpr’不是一个类型名 template <typename T> constexpr auto max_value() -> T { ^ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:340:23: 附注:C++11 ‘constexpr’ only available with -std=c++11 or -std=gnu++11 ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:343:23: 错误:‘constexpr’不是一个类型名 template <typename T> constexpr auto num_bits() -> int { ^ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:343:23: 附注:C++11 ‘constexpr’ only available with -std=c++11 or -std=gnu++11 ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:347:13: 错误:‘constexpr’不是一个类型名 template <> constexpr auto num_bits<int128_t>() -> int { return 128; } ^ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:347:13: 附注:C++11 ‘constexpr’ only available with -std=c++11 or -std=gnu++11 ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:348:13: 错误:‘constexpr’不是一个类型名 template <> constexpr auto num_bits<uint128_t>() -> int { return 128; } ^ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:348:13: 附注:C++11 ‘constexpr’ only available with -std=c++11 or -std=gnu++11 ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:349:13: 错误:‘constexpr’不是一个类型名 template <> constexpr auto num_bits<fallback_uintptr>() -> int { ^ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:349:13: 附注:C++11 ‘constexpr’ only available with -std=c++11 or -std=gnu++11 ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:363:1: 错误:expected unqualified-id before ‘using’ using iterator_t = decltype(std::begin(std::declval<T&>())); ^ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:364:23: 错误:expected unqualified-id before ‘using’ template <typename T> using sentinel_t = decltype(std::end(std::declval<T&>())); ^ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:368:57: 错误:ISO C++ 不允许声明无类型的‘get_data’ [-fpermissive] inline auto get_data(std::basic_string<Char>& s) -> Char* { ^ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:368:57: 错误:在文件层将‘get_data’声明为‘auto’ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:368:57: 错误:trailing return type only available with -std=c++11 or -std=gnu++11 ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:372:69: 错误:ISO C++ 不允许声明无类型的‘get_data’ [-fpermissive] inline auto get_data(Container& c) -> typename Container::value_type* { ^ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:372:69: 错误:在文件层将‘get_data’声明为‘auto’ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:372:69: 错误:trailing return type only available with -std=c++11 or -std=gnu++11 ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:384:23: 错误:expected unqualified-id before ‘using’ template <typename T> using checked_ptr = T*; ^ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:385:23: 错误:‘constexpr’不是一个类型名 template <typename T> constexpr auto make_checked(T* p, size_t) -> T* { ^ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:385:23: 附注:C++11 ‘constexpr’ only available with -std=c++11 or -std=gnu++11 In file included from ./spdlog/v1.9.2/include/spdlog/fmt/fmt.h:24:0, from ./spdlog/v1.9.2/include/spdlog/common.h:45, from ./spdlog/v1.9.2/include/spdlog/spdlog.h:12, from ./loglib/cclog.h:8, from ./loglib/ccdeclare.h:7, from source/subtitdspi.h:8, from source/user.h:4, from source/user_prog.cpp:1: ./spdlog/v1.9.2/include/spdlog/fmt/bundled/core.h:344:30: 错误:‘enable_if_t’未声明 # define FMT_ENABLE_IF(...) enable_if_t<(__VA_ARGS__), int> = 0 ^ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:392:31: 附注:in expansion of macro ‘FMT_ENABLE_IF’ template <typename Container, FMT_ENABLE_IF(is_contiguous<Container>::value)> ^ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/core.h:344:41: 错误:expected ‘>’ before ‘<’ token # define FMT_ENABLE_IF(...) enable_if_t<(__VA_ARGS__), int> = 0 ^ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:392:31: 附注:in expansion of macro ‘FMT_ENABLE_IF’ template <typename Container, FMT_ENABLE_IF(is_contiguous<Container>::value)> ^ In file included from ./spdlog/v1.9.2/include/spdlog/fmt/bundled/core.h:3234:0, from ./spdlog/v1.9.2/include/spdlog/fmt/fmt.h:24, from ./spdlog/v1.9.2/include/spdlog/common.h:45, from ./spdlog/v1.9.2/include/spdlog/spdlog.h:12, from ./loglib/cclog.h:8, from ./loglib/ccdeclare.h:7, from source/subtitdspi.h:8, from source/user.h:4, from source/user_prog.cpp:1: ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:398:8: 错误:expected type-specifier before ‘checked_ptr’ -> checked_ptr<typename Container::value_type> { ^ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:398:8: 错误:expected initializer before ‘checked_ptr’ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:406:21: 错误:ISO C++ 不允许声明无类型的‘reserve’ [-fpermissive] inline auto reserve(buffer_appender<T> it, size_t n) -> buffer_appender<T> { ^ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:406:21: 错误:在文件层将‘reserve’声明为‘auto’ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:406:21: 错误:‘fmt::v8::detail::reserve’声明为‘inline’变量 ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:406:21: 错误:‘int fmt::v8::detail::reserve’声明为模板 ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:406:21: 错误:‘buffer_appender’在此作用域中尚未声明 ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:406:38: 错误:expected primary-expression before ‘>’ token inline auto reserve(buffer_appender<T> it, size_t n) -> buffer_appender<T> { ^ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:406:40: 错误:‘it’在此作用域中尚未声明 inline auto reserve(buffer_appender<T> it, size_t n) -> buffer_appender<T> { ^ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:406:51: 错误:expected primary-expression before ‘n’ inline auto reserve(buffer_appender<T> it, size_t n) -> buffer_appender<T> { ^ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:413:1: 错误:‘constexpr’不是一个类型名 constexpr auto reserve(Iterator& it, size_t) -> Iterator& { ^ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:413:1: 附注:C++11 ‘constexpr’ only available with -std=c++11 or -std=gnu++11 ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:418:1: 错误:expected unqualified-id before ‘using’ using reserve_iterator = ^ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:422:1: 错误:‘constexpr’不是一个类型名 constexpr auto to_pointer(OutputIt, size_t) -> T* { ^ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:422:1: 附注:C++11 ‘constexpr’ only available with -std=c++11 or -std=gnu++11 ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:425:39: 错误:ISO C++ 不允许声明无类型的‘to_pointer’ [-fpermissive] template <typename T> auto to_pointer(buffer_appender<T> it, size_t n) -> T* { ^ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:425:39: 错误:在文件层将‘to_pointer’声明为‘auto’ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:425:39: 错误:‘int fmt::v8::detail::to_pointer’声明为模板 ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:425:39: 错误:‘buffer_appender’在此作用域中尚未声明 ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:425:56: 错误:expected primary-expression before ‘>’ token template <typename T> auto to_pointer(buffer_appender<T> it, size_t n) -> T* { ^ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:425:58: 错误:‘it’在此作用域中尚未声明 template <typename T> auto to_pointer(buffer_appender<T> it, size_t n) -> T* { ^ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:425:69: 错误:expected primary-expression before ‘n’ template <typename T> auto to_pointer(buffer_appender<T> it, size_t n) -> T* { ^ In file included from ./spdlog/v1.9.2/include/spdlog/fmt/fmt.h:24:0, from ./spdlog/v1.9.2/include/spdlog/common.h:45, from ./spdlog/v1.9.2/include/spdlog/spdlog.h:12, from ./loglib/cclog.h:8, from ./loglib/ccdeclare.h:7, from source/subtitdspi.h:8, from source/user.h:4, from source/user_prog.cpp:1: ./spdlog/v1.9.2/include/spdlog/fmt/bundled/core.h:344:30: 错误:‘enable_if_t’未声明 # define FMT_ENABLE_IF(...) enable_if_t<(__VA_ARGS__), int> = 0 ^ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:433:31: 附注:in expansion of macro ‘FMT_ENABLE_IF’ template <typename Container, FMT_ENABLE_IF(is_contiguous<Container>::value)> ^ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/core.h:344:41: 错误:expected ‘>’ before ‘<’ token # define FMT_ENABLE_IF(...) enable_if_t<(__VA_ARGS__), int> = 0 ^ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:433:31: 附注:in expansion of macro ‘FMT_ENABLE_IF’ template <typename Container, FMT_ENABLE_IF(is_contiguous<Container>::value)> ^ In file included from ./spdlog/v1.9.2/include/spdlog/fmt/bundled/core.h:3234:0, from ./spdlog/v1.9.2/include/spdlog/fmt/fmt.h:24, from ./spdlog/v1.9.2/include/spdlog/common.h:45, from ./spdlog/v1.9.2/include/spdlog/spdlog.h:12, from ./loglib/cclog.h:8, from ./loglib/ccdeclare.h:7, from source/subtitdspi.h:8, from source/user.h:4, from source/user_prog.cpp:1: ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:435:27: 错误:‘checked_ptr’未声明 checked_ptr<typename Container::value_type>) ^ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:435:38: 错误:expected ‘,’ or ‘...’ before ‘<’ token checked_ptr<typename Container::value_type>) ^ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:436:13: 错误:ISO C++ 不允许声明无类型的‘base_iterator’ [-fpermissive] -> std::back_insert_iterator<Container> { ^ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:436:13: 错误:在文件层将‘base_iterator’声明为‘auto’ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:436:13: 错误:trailing return type only available with -std=c++11 or -std=gnu++11 ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:441:1: 错误:‘constexpr’不是一个类型名 constexpr auto base_iterator(Iterator, Iterator it) -> Iterator { ^ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:441:1: 附注:C++11 ‘constexpr’ only available with -std=c++11 or -std=gnu++11 ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:449:8: 错误:ISO C++ 不允许声明无类型的‘fill_n’ [-fpermissive] -> OutputIt { ^ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:449:8: 错误:在文件层将‘fill_n’声明为‘auto’ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:449:8: 错误:trailing return type only available with -std=c++11 or -std=gnu++11 ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:454:65: 错误:ISO C++ 不允许声明无类型的‘fill_n’ [-fpermissive] FMT_CONSTEXPR20 auto fill_n(T* out, Size count, char value) -> T* { ^ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:454:65: 错误:在文件层将‘fill_n’声明为‘auto’ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:454:65: 错误:trailing return type only available with -std=c++11 or -std=gnu++11 ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:465:28: 警告:scoped enums only available with -std=c++11 or -std=gnu++11 [默认启用] enum char8_type : unsigned char {}; ^ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:470:68: 错误:ISO C++ 不允许声明无类型的‘copy_str_noinline’ [-fpermissive] OutputIt out) -> OutputIt { ^ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:470:68: 错误:在文件层将‘copy_str_noinline’声明为‘auto’ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:470:68: 错误:trailing return type only available with -std=c++11 or -std=gnu++11 ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:492:18: 错误:ISO C++ 不允许声明无类型的‘utf8_decode’ [-fpermissive] -> const char* { ^ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:492:18: 错误:在文件层将‘utf8_decode’声明为‘auto’ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:492:18: 错误:trailing return type only available with -std=c++11 or -std=gnu++11 ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:523:1: 错误:‘constexpr’不是一个类型名 constexpr uint32_t invalid_code_point = ~uint32_t(); ^ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:523:1: 附注:C++11 ‘constexpr’ only available with -std=c++11 or -std=gnu++11 ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:528:39: 错误:变量或字段‘for_each_codepoint’声明为 void FMT_CONSTEXPR void for_each_codepoint(string_view s, F f) { ^ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:528:39: 错误:‘string_view’在此作用域中尚未声明 ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:528:56: 错误:expected primary-expression before ‘f’ FMT_CONSTEXPR void for_each_codepoint(string_view s, F f) { ^ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:559:57: 错误:ISO C++ 不允许声明无类型的‘compute_width’ [-fpermissive] inline auto compute_width(basic_string_view<Char> s) -> size_t { ^ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:559:57: 错误:在文件层将‘compute_width’声明为‘auto’ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:559:57: 错误:trailing return type only available with -std=c++11 or -std=gnu++11 ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:564:43: 错误:‘fmt::v8::detail::compute_width’声明为‘inline’变量 FMT_CONSTEXPR inline size_t compute_width(string_view s) { ^ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:564:43: 错误:‘string_view’在此作用域中尚未声明 ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:564:58: 错误:expected ‘,’ or ‘;’ before ‘{’ token FMT_CONSTEXPR inline size_t compute_width(string_view s) { ^ In file included from ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:3099:0, from ./spdlog/v1.9.2/include/spdlog/fmt/bundled/core.h:3234, from ./spdlog/v1.9.2/include/spdlog/fmt/fmt.h:24, from ./spdlog/v1.9.2/include/spdlog/common.h:45, from ./spdlog/v1.9.2/include/spdlog/spdlog.h:12, from ./loglib/cclog.h:8, from ./loglib/ccdeclare.h:7, from source/subtitdspi.h:8, from source/user.h:4, from source/user_prog.cpp:1: ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format-inl.h:191:30: 错误:expected ‘}’ before end of line # pragma GCC diagnostic push ^ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format-inl.h:191:30: 错误:expected ‘}’ before end of line ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format-inl.h:191:30: 错误:expected ‘}’ before end of line ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format-inl.h:191:30: 错误:expected declaration before end of line make: *** [source/user_prog.o] 错误 1,请问要怎么修改才能正确运行demo2?
06-27
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值