Reputation: 1
I want to include the XGBoost
library in my C++
project. Here are the steps which I have followed:
GitHub
by using git.XGBoost
files using make -j4XGBoost
file can be found.
However, when I execute my code, here is the error message: It saying that undefined symbol with function name in c_api.h
Does anyone know how to solve this problem?
If I want to compile these files in Linux
, which command I should include in order to link the XGBoost
library. Thank you so much for your help!!
Upvotes: 0
Views: 743
Reputation:
Select project in navigator, under build settings,
Set "Other linker flags" (OTHER_LDFLAGS
) to the equivalent of "-L<path> -<flag>"
. For example, for {fmt}
, it would be -L/usr/local/Cellar/fmt/7.0.1/lib -lfmt
Find it out using pkg-config --libs <libname>
.
If the lib file(s) is not under path, set "Library search paths" (LIBRARY_SEARCH_PATHS ) to the parent directory of the library.
https://help.apple.com/xcode/mac/current/#/itcaec37c2a6
Upvotes: 0
Reputation: 1746
Did you set the DYLD_LIBRARY_PATH?
If you want to compile on linux. Saying you did the following in your home:
git clone --recursive https://github.com/dmlc/xgboost
cd xgboost
mkdir build
cd build
cmake ..
make -j4
you include path is:
-I ~/xgboost/include/xgboost
the library will libxgboost.so will be present in ~/xgboost/lib
In order to link with this library you must add:
-L ~/xgboost/lib -lxgboost
Since It is a shared lib (.so) you have to modify your LD_LIBRARY_PATH and export it.
export LD_LIBRARY_PATH=~/xgboost/lib:$LD_LIBRARY_PATH
ps: an other solution if you don't want to modify your LD_LIBRARY_PATH is to add
-Wl,-rpath=~/xgboost/lib
Upvotes: 1