[英]G++ linking with libpng
I'm trying to do some image processing using C++. 我正在尝试使用C ++进行一些图像处理。 I'm currently using OS X 10.7 and writing my code simply using a makefile and the terminal.
我目前正在使用OS X 10.7并使用makefile和终端编写代码。 I've used macports to install libpng but I still can't link with it.
我用过macports来安装libpng,但我还是无法用它连接。
g++ main.cpp -llibpng -O2 -o ImageManipulator
g++ main.cpp -lpng -O2 -o ImageManipulator
both fail with: 都失败了:
ld: library not found for -lpng
and 和
ld: library not found for -llibpng
does anyone know how to call g++ for this on OS X? 有谁知道如何在OS X上为此调用g ++?
I dont think macports does add its lib directory to the default path searched by gcc. 我不认为macports会将其lib目录添加到gcc搜索的默认路径中。 Try
尝试
g++ main.cpp -L/opt/local/lib -lpng -O2 -o ImageManipulator
使用-L / path / to / library_directory让g ++知道在哪里找到libpng(我已经忘记了mac ports安装库的地方)。
Got this error trying to install a gem (Mac OSX / Homebrew). 尝试安装gem时遇到此错误(Mac OSX / Homebrew)。 Fixed by running
brew update && brew install libpng && brew link libpng --force
通过运行
brew update && brew install libpng && brew link libpng --force
修复
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.