0
我试图编译代码示例我下载的web服务器(https://github.com/eidheim/Simple-Web-Server)用gcc-4.9和我碰到一个错误我不能解析:GCC-4.8(和4.9)不承认-std = C++ 11参数
src$ make
Makefile:45: http_examples.d: No such file or directory
/usr/bin/gcc-4.9 -MM http_examples.cpp -MT "http_examples.o http_examples.d" -MF http_examples.d
In file included from /usr/include/c++/4.9/regex:35:0,
from server_http.hpp:6,
from http_examples.cpp:1:
/usr/include/c++/4.9/bits/c++0x_warning.h:32:2: 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.
#error This file requires compiler and library support for the \
^
我曾经尝试都编译器选项既不可以解决该问题。以下是make文件中的相关位:
PROJECT = ToolBoxServer
# Compiler
CC = /usr/bin/gcc-4.9
# Run Options
COMMANDLINE_OPTIONS = /dev/ttyS0
# Compiler options during compilation
COMPILE_OPTIONS = -std=c++11 -pedantic -Wall -Wno-long-long -ggdb3 -gstabs -O0 -pthreads
#Header include directories
HEADERS = -I/usr/local/include -I./ -I/usr/local/include/boost
#Libraries for linking
LIBS = -lm -lmysqlcppconn
# Dependency options
DEPENDENCY_OPTIONS = -MM
# Compile every cpp file to an object
%.o: %.cpp
$(CC) -c $(COMPILE_OPTIONS) -o [email protected] $< $(HEADERS)
我使用的是gcc-4.8。我读过gcc 4.9已经(更好)支持正则表达式并安装它,但我得到了同样的错误。
有没有人遇到过这个?据我所知,gcc-4.9是最可用的C++ 11编译器。任何人都可以提出一种解决方法吗?
感谢
迈克
'-std = C++ 11'为C++,因此应使用'克++','不gcc'。 – juanchopanza 2014-09-02 16:19:48
这不是他错误的原因。这可能最终导致链接错误,但'gcc'支持'-std = C++ 11'选项,将编译为他的代码,C++,因为'.cpp'延伸。 – 2014-09-02 17:30:14
这不是一个GCC /克++问题。这是一个Makefile问题。 – 2014-09-02 17:50:03