相关疑难解决方法(0)

在mac上,默认情况下,g ++(clang)无法搜索/ usr/local/include和/ usr/local/lib

我在Mac上,我曾经homebrew安装过gmp.

Kyumins-iMac:gcjlib math4tots$ g++ main.cpp -lgmp -lgmpxx
In file included from main.cpp:2:
./gcjlib.hpp:4:10: fatal error: 'gmpxx.h' file not found
#include <gmpxx.h>
         ^
1 error generated.
Run Code Online (Sandbox Code Playgroud)

所以我明确告诉g++要使用/usr/local/include

Kyumins-iMac:gcjlib math4tots$ g++ main.cpp -lgmp -lgmpxx -I/usr/local/include
ld: library not found for -lgmp
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Run Code Online (Sandbox Code Playgroud)

所以我明确告诉g++要使用/usr/local/lib

Kyumins-iMac:gcjlib math4tots$ g++ main.cpp -lgmp -lgmpxx -I/usr/local/include -L/usr/local/lib
Kyumins-iMac:gcjlib math4tots$ ./a.out 
sum is -4444
absolute value …
Run Code Online (Sandbox Code Playgroud)

macos xcode gcc clang

41
推荐指数
3
解决办法
2万
查看次数

MacOS Sierra上找不到'openssl/conf.h'文件错误

我正在开发一个使用boost asio的C++项目.尝试构建使用亚洲的库,我收到以下错误

/usr/local/include/boost/asio/ssl/detail/openssl_types.hpp:19:10: fatal error: 'openssl/conf.h' file not found
#include <openssl/conf.h>
Run Code Online (Sandbox Code Playgroud)

在这里这里寻找解决方案,我试过了

brew install openssl
brew link openssl --force
xcode-select --install
Run Code Online (Sandbox Code Playgroud)

但没有帮助.

执行以下操作似乎也不起作用

export C_INCLUDE_PATH=/usr/local/include
export CPLUS_INCLUDE_PATH=/usr/local/include
Run Code Online (Sandbox Code Playgroud)

我正在使用的Boost版本是boost_1_63_0.我MacOS Sierra在一起Xcode 8.3.1.我用Homebrew安装了boost

brew install boost
Run Code Online (Sandbox Code Playgroud)

据我所知,从其他链接来看,Xcode正在寻找ssl头的错误位置.但是我怎么解决这个问题呢?

我看着我的/usr/local/include&/opt/local/include.两个地方都没有'openssl/ssl.h'.但做了brew install openssl以下说明

Warning: openssl is a keg-only and another version is linked to opt.
Use `brew install --force` if you want to install this version
Run Code Online (Sandbox Code Playgroud)

做一个brew …

ssl xcode homebrew boost cmake

6
推荐指数
1
解决办法
7044
查看次数

标签 统计

xcode ×2

boost ×1

clang ×1

cmake ×1

gcc ×1

homebrew ×1

macos ×1

ssl ×1