I've tried enabling C++11 in CDT by adding AX_CXX_COMPILE_STDCXX_11
to my configure.ac file. I've tried moving it around in the file, this seems like the only place where it doesn't error out. I've even tried adding the optional noext
flag, but that gives me a syntax error.
The code I'm trying to compile is:
#include <iostream>
#include <memory>
void
print_hello(){
std::unique_ptr<char[]> cha;
std::cout << "11?" << std::endl;
}
Where unique_ptr is of course a c++11 feature.
This is how my configure.ac looks:
dnl Process this file with autoconf to produce a configure script.
AC_PREREQ(2.64)
AC_INIT(fooProj, 1.0)
AC_CANONICAL_SYSTEM
AC_PROG_CXX
AC_LANG([C++])
AX_CXX_COMPILE_STDCXX_11
dnl Initialize automake
AM_INIT_AUTOMAKE
dnl this allows us specify individual liking flags for each target
AM_PROG_CC_C_O
dnl Initialize Libtool
LT_INIT
dnl Check if Libtool is present
dnl Libtool is used for building share libraries
AC_PROG_LIBTOOL
AC_CONFIG_FILES(Makefile
exampleProgram/Makefile
libTestLib/Makefile
include/Makefile)
AC_OUTPUT
If all your want is make your code compile to the C++11 standard, then clean your build, then add AM_CXXFLAGS = -std=c++11
to the Makefile.am
where your source is, then rebuild. The AX_CXX_COMPILE_STDCXX_11
in configure.ac
is unnecessary for this.