gpt4 book ai didi

c++ - 生成文件 - C++11

转载 作者:行者123 更新时间:2023-11-28 03:04:43 28 4
gpt4 key购买 nike

我试图理解 MakeFiles,并试图在我的 make 文件中将 CFLAGS 设置为 C++11。我已阅读以下内容:Makefile modification to support c++11我已经实现了其中一种解决方案,但是它似乎不起作用,我遇到了同样的错误:

error: ‘i’ does not name a type for(auto i=begin; (i != end); i++)

这是我的生成文件:

# Location of the Python Header files 
# This is system dependant.

PYTHON_VERSION = 2.7
PYTHON_INCLUDE = /usr/include/python$(PYTHON_VERSION)

CFLAGS += -03
CFLAGS += -std=c++0x
CFLAGS += -pg -D_DEBUG -g -c -Wal
# location of the Boost Python include files and library

BOOST_INC = /usr/include
BOOST_LIB = /usr/lib

WAV_TARGET = /includes/Wav
WAV_SOURCE = Wav

# Compile the .wav Python and Cpp file

$(WAV_TARGET).so: $(WAV_TARGET).o
g++ -shared -Wl, --export-dynamic ($WAV_TARGET).o -L$(BOOST_LIB) -lboost_python -
L/usr/lib/python$(PYTHON_VERSION)/config -lpython$(PYTHON_VERSION) -o
$(WAV_TARGET).so
$(WAV_TARGET).o: $(WAV_SOURCE).cpp
g++ -I$(PYTHON_INCLUDE) -I$(BOOST_INC) -fPIC -c Wav.cpp

我可能遗漏了一些非常愚蠢的东西,但我哪里出错了?

最佳答案

在调用 g++ 时,您的目标甚至没有使用 CFLAGS。您可以将 $(CFLAGS) 添加到目标:

$(WAV_TARGET).o: $(WAV_SOURCE).cpp
g++ $(CFLAGS) -I$(PYTHON_INCLUDE) -I$(BOOST_INC) -fPIC -c Wav.cpp

或者只需将 -std=c++11 添加到您列出的标志中:

$(WAV_TARGET).o: $(WAV_SOURCE).cpp
g++ -std=c++11 -I$(PYTHON_INCLUDE) -I$(BOOST_INC) -fPIC -c Wav.cpp

关于c++ - 生成文件 - C++11,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20019239/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com