具有自动工具的CDT中的C++11
C++11 in CDT with autotools
我已经尝试在CDT中通过将AX_CXX_COMPILE_STDCXX_11
添加到我的config.ac文件来启用C++11。我试着在文件中移动它,这似乎是唯一一个不会出错的地方。我甚至尝试添加可选的noext
标志,但这会导致语法错误。
我试图编译的代码是:
#include <iostream>
#include <memory>
void
print_hello(){
std::unique_ptr<char[]> cha;
std::cout << "11?" << std::endl;
}
其中unique_ptr当然是一个c++11特性。
这就是我的配置.ac的样子:
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
如果您只想让代码编译到C++11标准,那么请清理您的构建,然后将AM_CXXFLAGS = -std=c++11
添加到源代码所在的Makefile.am
中,然后重新生成。configure.ac
中的AX_CXX_COMPILE_STDCXX_11
对此是不必要的。
您需要gnu网站[1]上这个页面上的m4宏。将其保存为项目根目录中的ax_cxx_compile_stdcxx_11.m4。
[1] :http://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx_11.html"
sudo apt-get install autoconf-archive
相关文章:
- Eclipse CDT 项目中的缺省C++标准是什么?
- 如何使用Eclipse CDT中的Google测试来管理测试输出
- 检查Eclipse CDT调试器中的STD :: vector的内容
- Win7中的Eclipse CDT(Juno):在PATH中找不到g++,iostream未解析和其他有趣的东西
- Eclipse CDT无法在STL容器中的元素上解析方法
- 在Eclipse CDT中未识别的结构
- 在C Eclipse CDT中构建不同的值
- 未解决的内容包括在Eclipse CDT中,其中路径名不确定
- eclipse中的C++:更新后?:CDT错误
- 如何取回从 Eclipse CDT 中的构建配置中排除的文件
- Eclipse CDT 中的单元测试
- 使用 gdb 漂亮的打印机在 eclipse cdt 中显示智能指针
- Eclipse CDT 中不必要的导入
- Eclipse CDT:导入的文件不包含在构建中
- 具有自动工具的CDT中的C++11
- 如何在Eclipse CDT中的共享库项目中使用静态库
- Eclipse CDT插件无法识别某些文件中的std命名空间
- Eclipse CDT中的POSIX IPC连接器错误
- Eclipse CDT中的项目依赖项
- 抑制/删除Eclipse CDT中的特定错误