compile and link C/CPP programs on Mac
2024-10-07 08:06:09
ref: https://stackoverflow.com/questions/29987716/cannot-use-gsl-library-on-macos-ld-symbols-not-found-for-architecture-x86-6
Indeed, as @trojanfoe and @bergercookie said you have to compile your file and then link it to the library. As explained in compile and link, for that particular example:
First compile the file:
gcc -Wall -I/usr/local/include -c example.c -o example.o
second, link it to the library:
gcc -L/usr/local/lib example.o -lgsl -o example
where of course, /usr/local/lib should be replaced for the path where you have gsl installed.
Theexample
file is excutable.
EDIT: in macOS, from Yosemite the default location for the installation is /opt/local/lib (and /opt/local/include)
最新文章
- SVN的部署及分支等方法
- 实践最简单的项目:WC
- js基础到精通全面教程--JS教程
- uglifyjs2压缩混淆js文件
- adapter.notifyDataSetChanged(); 没有反应
- varnish 的一个配置
- java之BASE64加解密
- 数据分析(4):Scipy
- lightoj 1397 - Sudoku Solver
- UserControl和CustomControl基础【PluraSight】
- CodeForces 706B Interesting drink (二分查找)
- c++设计模式之状态模式
- Android基础总结(精华完整版)
- 帆软的报表系统与泛微OA结合起来,这两个软件麦枫提供了经典的服务。
- 浅谈spring为什么推荐使用构造器注入
- undefined reference to symbol '_ZNK11GenICam_3_016GenericException17GetSourceFileNameEv'
- win10 下JDK10的下载安装与环境变量配置
- SQL SERVER TRANSACTION 事物
- Redis集群的操作
- Word 2010 制作文档结构之页码从正文开始设置