- 下载Nlopt软件包:
https://github.com/stevengj/nlopt - 解压:
tar xvzf nlopt-2.6.1.tar.gz
- 修改CMakeLists.txt文件:
添加set (CMAKE_C_COMPILER "/usr/local/arm-linux-gnueabi-gcc") set (CMAKE_CXX_COMPILER "/usr/local/arm-linux-gnueabi-g++")
- 配置生成静态库
cmake -DBUILD_SHARED_LIBS=off .
- 编译
make
- 拷贝静态库到默认路径(可选)
sudo make install
- 编写测试程序test.c
参考以下链接https://nlopt.readthedocs.io/en/latest/NLopt_Tutorial/ - 编译
arm-linux-gnueabi-g++ -c -Wall -I/your/head/include/path arm-linux-gnueabi-g++ test.o -L/your/nlopt/lib/path -lnlopt -lm -static -o test
- 运行
./test
非线性优化库Nlopt安装、使用说明
最新推荐文章于 2024-06-27 17:02:25 发布