说明


  • 本人也是第一次配置,边配置,边截图,边发博客
  • 配置分为单独的 CGAL 配置和 Qt 下的配置

1. 下载


注意 boost 版本号与自己的 VS 版本一致,不知道的参考以下博客
MSVC 版本号对应

这个下载一个 release 版就行

尽量找一个高版本

2. 配置 boost x64


其实编译 boost 需要注意的还挺多,你是要编译动态库还是静态库,你是要基于什么编译器进行编译,你是要编译 x86 的还是 x64 的等等,具体参考下面两个博客,尤其是第一个博客,因为目前我们只是以学习 CGAL 为主,默认的这些编译方式就无所谓了,但是以后涉及到大工程时,你就不得不注意!!!

boost 作为很多开源库的三方库,你的电脑中可能已经有了,有的话没必要重复安装,安装多了有时候造成冲突自己都不知道…

参考博客一:boost 1.56.0 编译及使用
参考博客二:CGAL的64位开发环境配置

  • 双击 bootstrap.bat

有人说这里要用 VS 的 x64 命令行工具,其实也没必要,用了也没错

  • cmd 调出来,切换到当前目录,输入 bjam address-model=64(这里的 address-model=64 是编译生成 x64 的库),然后回车

  • 编译完成后

  • ./boost/ 就是头文件,相当于 include 文件夹

  • ./stage/lib/ 就是静态库

  • 至于动态库是什么歌鬼,用到再说

  • 测试一下,新建 win32 工程项目,VC++包含目录、VC++库目录、链接器-输入-附加依赖项自己添加,工程属性改成 x64 的平台,debug 和 release 无所谓

提示一:快速获取当前目录下所有文件名,新建一个 .bat,内容写 DIR *.* /B>result.txt
提示二:最好在系统环境变量下把 boost 根目录加进来

stage/lib 下的所有 lib

libboost_atomic-vc120-mt-gd-x64-1_70.lib
libboost_atomic-vc120-mt-x64-1_70.lib
libboost_container-vc120-mt-gd-x64-1_70.lib
libboost_container-vc120-mt-x64-1_70.lib
libboost_context-vc120-mt-gd-x64-1_70.lib
libboost_context-vc120-mt-x64-1_70.lib
libboost_date_time-vc120-mt-gd-x64-1_70.lib
libboost_date_time-vc120-mt-x64-1_70.lib
libboost_exception-vc120-mt-gd-x64-1_70.lib
libboost_exception-vc120-mt-x64-1_70.lib
libboost_filesystem-vc120-mt-gd-x64-1_70.lib
libboost_filesystem-vc120-mt-x64-1_70.lib
libboost_iostreams-vc120-mt-gd-x64-1_70.lib
libboost_iostreams-vc120-mt-x64-1_70.lib
libboost_math_c99-vc120-mt-gd-x64-1_70.lib
libboost_math_c99-vc120-mt-x64-1_70.lib
libboost_math_c99f-vc120-mt-gd-x64-1_70.lib
libboost_math_c99f-vc120-mt-x64-1_70.lib
libboost_math_c99l-vc120-mt-gd-x64-1_70.lib
libboost_math_c99l-vc120-mt-x64-1_70.lib
libboost_math_tr1-vc120-mt-gd-x64-1_70.lib
libboost_math_tr1-vc120-mt-x64-1_70.lib
libboost_math_tr1f-vc120-mt-gd-x64-1_70.lib
libboost_math_tr1f-vc120-mt-x64-1_70.lib
libboost_math_tr1l-vc120-mt-gd-x64-1_70.lib
libboost_math_tr1l-vc120-mt-x64-1_70.lib
libboost_numpy36-vc120-mt-gd-x64-1_70.lib
libboost_numpy36-vc120-mt-x64-1_70.lib
libboost_prg_exec_monitor-vc120-mt-gd-x64-1_70.lib
libboost_prg_exec_monitor-vc120-mt-x64-1_70.lib
libboost_program_options-vc120-mt-gd-x64-1_70.lib
libboost_program_options-vc120-mt-x64-1_70.lib
libboost_random-vc120-mt-gd-x64-1_70.lib
libboost_random-vc120-mt-x64-1_70.lib
libboost_regex-vc120-mt-gd-x64-1_70.lib
libboost_regex-vc120-mt-x64-1_70.lib
libboost_serialization-vc120-mt-gd-x64-1_70.lib
libboost_serialization-vc120-mt-x64-1_70.lib
libboost_stacktrace_noop-vc120-mt-gd-x64-1_70.lib
libboost_stacktrace_noop-vc120-mt-x64-1_70.lib
libboost_stacktrace_windbg-vc120-mt-gd-x64-1_70.lib
libboost_stacktrace_windbg-vc120-mt-x64-1_70.lib
libboost_system-vc120-mt-gd-x64-1_70.lib
libboost_system-vc120-mt-x64-1_70.lib
libboost_wserialization-vc120-mt-gd-x64-1_70.lib
libboost_wserialization-vc120-mt-x64-1_70.lib
  • 测试代码
#include <boost/lexical_cast.hpp>
#include <iostream>

using namespace std;

int main() {
    using boost::lexical_cast;
    int a = lexical_cast<int>("123");
    double b = lexical_cast<double>("123.0123456789");
    string s0 = lexical_cast<string>(a);
    string s1 = lexical_cast<string>(b);
    cout << "number: " << a << "  " << b << endl;
    cout << "string: " << s0 << "  " << s1 << endl;
    int c = 0;
    try {
        c = lexical_cast<int>("abcd");
    } catch (boost::bad_lexical_cast &e) {
        cout << e.what() << endl;
    }
    getchar();
    return 0;
}
  • 正常运行结果

CGAL + VS2013 配置关键步骤

3. 解压 CGAL


  • 说是安装,其实就是解压的过程,不多说

4. 编译 CGAL


  • 打开 CMake
  • Where is the source code:把 CMakeLists.txt 拖进来就好
  • Where to build the binaries:我选择新建 build 文件夹
  • Configure
  • Visual Studio 12 2013 Win64,一定选择 Win64
  • Use default native compilers
  • 此时,我遇到了错误

CGAL + VS2013 配置关键步骤

  • 解决办法:

Qt 下的嵌套使用


请参考这篇博客:win10+ vs2015+QT5.7.0+boost_1_62_0+ CMake3.7.0+cgal-4.9的64位开发环境配置

5. 参考博客


  1. QT5.11.1+MinGW+CGAL4.11(QT配置CGAL库)
  2. CGAL4.9+boost1.59+QT5.6+vs2015 64bit+windows10配置
  3. VS2013环境下Boost库配置
  4. Boost编译的一些注意事项
  5. CGAL编译与配置
  6. 其它…

visual studio2010问题导致CMake执行例子时出错Error in configuration process,project files may be invalid

CMake error: error in configuration process, project files may be invalid

相关文章: