I was recently advised to check out conda as a package manager. Unfortunately I don't succeed in finding how to make my compiler find a header-only library installed with conda? Ideally I would like to not having to manually specify a path to my compiler at all.
(The context is that I come from homebrew on macOS, which creates symbolic links on the right locations. Obviously this is what conda avoids. But still, a simple way to compile simple examples would be nice!)
For example, if my code is the one below. Note: this question is meant to be generic, not related to a specific package, nor do I want to have to manually specify again my specific virtual environment.
#include <iostream>
#include <xtensor/xarray.hpp>
#include <xtensor/xio.hpp>
int main()
{
xt::xarray<double> a
{{1.0, 2.0, 3.0},
{2.0, 5.0, 7.0},
{2.0, 5.0, 7.0}};
std::cout << a;
}
I have 'installed' the library using
conda create --name example
source activate example
conda install -c conda-forge xtensor-python
Now I would like to compile just with
clang++ -std=c++14 test.cpp
Note that I know that this works:
clang++ -std=c++14 -I~/miniconda3/envs/example/include test.cpp
But I don't think that this is wanted, because:
example
).At least on unix systems, a solution would be to use
clang++ -std=c++14 -I"${CONDA_PREFIX}"/include test.cpp
thereby "${CONDA_PREFIX}"
point to the root of the current conda environment. In this case:
~/miniconda3/envs/example