如何使用带有C11标准的make编译程序

时间:2017-04-29 09:42:14

标签: c++ c++11 gcc g++

我使用的是Ubuntu 14.04 我正在编写OMNET ++,但收到了错误

pythonexporter.cc: In member function ‘virtual void omnetpp::scave::PythonExporter::saveResults(const string&, omnetpp::scave::ResultFileManager*, const omnetpp::scave::IDList&, omnetpp::common::IProgressMonitor*)’:
pythonexporter.cc:261:5: error: ‘unique_ptr’ is not a member of ‘std’
 std::unique_ptr<RunList> tmp(runList);
 ^
pythonexporter.cc:261:28: error: expected primary-expression before ‘>’ token
 std::unique_ptr<RunList> tmp(runList);
                        ^
pythonexporter.cc:261:41: error: ‘tmp’ was not declared in this scope
 std::unique_ptr<RunList> tmp(runList);
                                     ^
make[2]: *** [/home/user/final_project/omnetpp-5.1/out/gcc-release/src/scave/pythonexporter.o] Error 1
make[2]: Leaving directory `/home/user/final_project/omnetpp-5.1/src/scave'
make[1]: *** [scave] Error 2
make[1]: Leaving directory `/home/user/final_project/omnetpp-5.1'
make: *** [allmodes] Error 2

我做了一些研究,发现我需要使用C11编译器我试图改变configure.user文件中的不同选项,但我仍然得到相同的错误。这是我的configure.user文件

# configure.user
#
# This file contains additional input for 'configure'. It is read (sourced)
# during the configuration process. You are free to edit the settings in here.
#
# The settings in this file are all optional in the sense that they all
# have reasonable default values in the configure script.
#

#
# Edit here if you want to use a different compiler from the one autodetected
# by configure. Turns off the compiler autodetection.
#
CC=gcc
CXX=g++
CFLAGS=-O3 -std=c++0x -pg -D_DEBUG -g -c -Wall
CXXFLAGS=-O3 -std=c++0x -pg -D_DEBUG -g -c -Wall

#
# Set to "yes" if you want to use clang/clang++ instead of gcc/g++ when both
# compiler is installed.
PREFER_CLANG=yes

#
# Compiler optimization switches. There are two sets of switches,
# and the MODE variable ("debug" or "release") decides which one gets used.
# (Note: For maximum debugging info use switch -ggdb or -gstabs+3 when using gcc and gdb)
# With gcc, do NOT use --omit-frame-pointer (it crashes when coroutines and
# C++ exceptions (throw/catch) are used together)!
#
CFLAGS_DEBUG='-g -std=c++11 -Wall'
CFLAGS_RELEASE='-O2 -std=c++11 -DNDEBUG=1'

#
# Linker switches used for linking.
#
#LDFLAGS="-std=c++11"

#
# Set to "yes" to enable the Tcl/Tk based graphical runtime environment (Tkenv)
#
WITH_TKENV=yes

#
# Set to "yes" to enable the Qt based graphical runtime environment (Qtenv)
#
WITH_QTENV=yes

#
# Set to "yes" to use Qtenv as the default graphical runtime environment (instead of Tkenv)
#
PREFER_QTENV=yes

#
# Set to "yes" to enable OpenSceneGraph and support in Qtenv
#
WITH_OSG=yes

#
# Set to "yes" to enable osgEarth support in Qtenv (requires OpenScreenGraph enabled)
#
WITH_OSGEARTH=yes

#
# Set to "yes" to enable simulation executables to load NED files dynamically.
#
WITH_NETBUILDER=yes

#
# Set to "yes" to enable the parallel distributed simulation feature.
#
WITH_PARSIM=yes

#
# Set to "yes" to use SQLite as default file format for output vector and
# output scalar files. As of version 5.1, SQLite support is an experimental 
# feature.
#
# To try SQLite result files without changing the default, add the following
# lines into the omnetpp.ini files of your simulations (or specify the same 
# settings on the simulation command line, with the "--" prefix):
#
# outputvectormanager-class="omnetpp::envir::SqliteOutputVectorManager"
# outputscalarmanager-class="omnetpp::envir::SqliteOutputScalarManager"
#
PREFER_SQLITE_RESULT_FILES=no

#
# Set to "yes" to enable SystemC support. (Available only in the commecial version (OMNEST))
# Please note that SystemC is not supported on MAC OS X and on the MinGW compiler on Windows.
#
WITH_SYSTEMC=no

#
# Set to no if you want to create static OMNeT++ libraries. Can be overriden
# with "make SHARED_LIBS=no" but then simulation models also need to be built
# with "make SHARED_LIBS=no"
#
SHARED_LIBS=yes

#
# Compiler and linker options for Tcl/Tk
#
# You can explicitly tell 'configure' which compile switches (TK_CFLAGS)
# and linker switches (TK_LIBS) are needed to build an application with Tcl/Tk.
# Normally these settings are autodetected by 'configure', so you only need to
# edit here if autodetection doesn't work.
#
# With gcc, settings typically look like this:
#
# exaple:TK_CFLAGS="-I/usr/local/include"
# example:TK_LIBS="-L/usr/local/lib -ltk8.6 -ltcl8.6 -lX11"
#
# /usr/local/include should be replaced with the directory where tcl.h and tk.h
# live. If they are in two different directories, use two -I switches.
#
# /usr/local/lib should be replaced with the directory that contains the Tcl/Tk
# library files (something like libtcl86.so, libtk8.6.a etc; search for libtcl*
# and libtk* to find them.) The -l options contain the library names: the
# library file names, with the leading 'lib' and trailing '.so*' or '.a*' cut
# off. Sometimes you need to explicitly link with the X11 libraries too, in that
# case add -lX11 to TK_LIBS.
#
# With MinGW I use the following:
# Note that we are using the "bin" directory as the LIB dir.
# i.e. directly linking to the DLLs instead of the importlibs in the "lib" directory.
#
#TK_CFLAGS="-I/c/Tools/Tcl-8.6.0/include"
#TK_LIBS="-L/c/Tools/Tcl-8.6.0/bin -ltk84 -ltcl84"
# or:
#TK_CFLAGS="-I$MSYS/include/tcl8.6"
#TK_LIBS="-L$MSYS/bin -ltk86 -ltcl86"

#
# It is possible to have the Tcl files embedded into the compiled     OMNeT++
# libraries and executables. This can be useful if you want to ship
# self-contained standalone executables which do not rely on external
# Tcl scripts. This option is available for Tkenv.
#
EMBED_TCL_CODE=yes

#
# Compiler and linker options for Qt
#
# If you wish to use a custom Qt bundle (for example downloaded from the
# official Qt web page, or built from source) instead of the one installed
# on your system as the default (most likely by the package manager), set
# this variable to the 'bin' directory of that bundle, where qmake is.
# Leave it empty or commented out to use the default Qt installation.
# Please note that on Windows and macOS it is highly recommended to just
# use the Qt bundle included in the OMNeT++ release, and not change this.
#
#QT_PATH="/home/user/Qt/5.7/gcc_64/bin"
#
# You can also explicitly tell 'configure' what compiler options (QT_CFLAGS)
# and linker switches (QT_LIBS) are needed to build an application with Qt
# support. Normally these are autodetected by 'configure' using the QT_PATH
# variable above, so you only need to edit here if autodetection doesn't work.
#
#QT_CFLAGS=
#QT_LIBS=

#
# OpenSceneGraph libraries we want to use. Leave empty for autodetection
# or specify some invalid value (like "no" to explicitly disable     OpenSceneGraph)
# At least the following libraries must be found: osg osgGA osgViewer     osgQt OpenThreads
#
#OSG_LIBS=

# osgEarth libraries to be used. Leave empty for autodetection.
# At least the following libraries are required: osgEarth osgEarthUtil
#
#OSGEARTH_LIBS=

#
# ZLib is a compression library needed by libxml2 and Tkenv's png support.
#
# On MinGW we use the following (dynamically linking against the DLL)
#
#ZLIB_CFLAGS="-I/c/Tools/zlib-1.2.3/include"
#ZLIB_LIBS="-L/c/Tools/zlib-1.2.3/bin -lzlib1"
# or:
#ZLIB_CFLAGS="-I$MSYS/include"
#ZLIB_LIBS="-L$MSYS/lib -lz"

#
# Compiler flags used to compile JNI code.
# -fno-strict-aliasing is needed for gcc when using -O2 otherwise Java
# native calls don't work
#
#JAVA_CFLAGS=-fno-strict-aliasing

#
# Compiler and linker options for MPI (optional component).
# On LAM/MPI, typing `mpic++ -showme' can give you a hint about MPI_LIBS.
#
# If commented out, the configure script will try to autodetect it
#
#MPI_CFLAGS="-I /usr/include"
#MPI_LIBS="-pthread -llammpio -llammpi++ -llamf77mpi -lmpi -llam -laio -laio -lutil"
#MPI_LIBS="-lmpi++ -lmpi"   #SGI

#
# Compiler and linker options for Expat (optional component)
#
# With MinGW I use the following:
#   EXPAT_CFLAGS="-I/d/home/tools/expat-1.95.2/Source/lib"
#   EXPAT_LIBS="-L/d/home/tools/expat-1.95.2/libs -lexpat"
# If commented out, the configure script will try to autodetect it
#
#EXPAT_CFLAGS=
#EXPAT_LIBS=

#
# Compiler and linker options for LIBXML (optional component)
#
# With MinGW I use the following:
#  LIBXML_CFLAGS="-I/c/Tools/libxml2-2.6.20.win32/include -I/c/Tools/iconv-1.9.1.win32/include"
#  LIBXML_LIBS="-L/c/Tools/libxml2-2.6.20.win32/bin -lxml2 -L/c/Tools/iconv-1.9.1.win32/lib -liconv"
# or:
#  LIBXML_CFLAGS="-I$MSYS/include"
#  LIBXML_LIBS="-L$MSYS/bin -lxml2 -L$MSYS/bin -liconv"
# If commented out, the configure script will try to autodetect it
#

#
# Compiler and linker options for Akaroa (optional component)
#
# With MinGW I use the following:
#  AKAROA_CFLAGS="-I/d/home/tools/akaroa-2.7.4/include"
#  AKAROA_LIBS="-L/d/home/tools/akaroa-2.7.4/lib -lakaroa"
# If commented out, the configure script will try to autodetect it
#
#AKAROA_CFLAGS=
#AKAROA_LIBS=

#
# The following OMNETPP_* variables don't need to be touched unless
# you want to relocate parts of the package (e.g. put libraries to
# /usr/lib, include files to /usr/include/omnetpp, and so on).
#
#OMNETPP_SRC_DIR="$OMNETPP_ROOT/src"
#OMNETPP_SAMPLES_DIR="$OMNETPP_ROOT/samples"
#OMNETPP_BIN_DIR="$OMNETPP_ROOT/bin"
#OMNETPP_INCL_DIR="$OMNETPP_ROOT/include"
#OMNETPP_LIB_DIR="$OMNETPP_ROOT/lib"

#
# Some more OMNeT++ variables. They select the programs opp_makemake-generated
# makefiles will use. (They get default values if commented out.)
#
#MSGC="$OMNETPP_BIN_DIR/opp_msgc"
#SMC="$OMNETPP_BIN_DIR/opp_smc"

#
#
# Override the following setting if you have additional icons somewhere else.
#
# OMNETPP_IMAGE_PATH="./images;./bitmaps;$OMNETPP_ROOT/images"

我正在使用gcc 4.8编译器

1 个答案:

答案 0 :(得分:0)

将编译器更新为GCC 6解决了我的问题。

感谢大家的帮助。