尝试从已编译的源文件创建目标文件时出现编译错误.我正在使用c ++ 11附带的标题.我还使用了c ++模式识别库和其他几个包含.
我所做的就是添加#include <thread>到我的rbm_test.cc源文件中.
我的编译命令:
g ++ -std = c ++ 11 -O3 -DQUIET -fPIC -pthread -ansi -pedantic -DARCH_INTEL -Wall -W -Wchar-subscripts -Wpointer-arith -Wcast-qual -Wwrite-strings -Wconversion -Wno-old-style -cast -Wctor-dtor-privacy -Wnon-virtual-dtor -I ../ src -I ../ .. -DPATREC -D_ UNIX _ -o rbm_test.o -c ../src/rbm_test.cc
我得到的编译错误是:
错误:#error此文件需要ISO C++ 2011标准的编译器和库支持.此支持目前是实验性的,必须使用-std = c ++ 11或-std = gnu ++ 11编译器选项启用.
奇怪的是,当我编译下面的代码示例时
g ++ -std = c ++ 11 -pthread -c main.cpp -o main.o
那我没有错.
这是 main.cpp
#include <iostream>
#include <thread> …Run Code Online (Sandbox Code Playgroud)