gcc-4.9를 사용하여 웹 서버 (https://github.com/eidheim/Simple-Web-Server) 용으로 다운로드 한 코드 예제를 컴파일하려고하는데 오류가 있습니다. 해결 :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'가 아니라'g ++'를 사용해야합니다. – juanchopanza
그건 그 사람의 잘못이 아니야. 결국 링크 오류가 발생할 수 있지만'gcc'는'-std = C++ 11' 옵션을 지원하고'.cpp' 확장 때문에 C++ 코드를 컴파일합니다. –
이것은 gcc/g ++ 문제가 아닙니다. 이것은 Makefile 문제입니다. –