码迷,mamicode.com
首页 > 系统相关 > 详细

compile and link C/CPP programs on Mac

时间:2019-10-28 19:11:42      阅读:98      评论:0      收藏:0      [点我收藏+]

标签:ati   https   -o   lin   tac   replace   rar   http   default   

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.
The example file is excutable.
EDIT: in macOS, from Yosemite the default location for the installation is /opt/local/lib (and /opt/local/include)

compile and link C/CPP programs on Mac

标签:ati   https   -o   lin   tac   replace   rar   http   default   

原文地址:https://www.cnblogs.com/sonictl/p/11754232.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!