guitargeek / XGBoost-FastForest

Minimal library code to deploy XGBoost models in C++.
MIT License
86 stars 30 forks source link

gcc version #4

Closed FanniSun closed 4 years ago

FanniSun commented 4 years ago

when I use gcc 4.8 to install, I got issue like this: `/home/fanni/za/c_plus/XGBoost-FastForest-master/src/fastforest.cpp:36:35: fatal error: experimental/filesystem: No that file or directory

include <experimental/filesystem>

                               ^

compilation terminated. CMakeFiles/fastforest.dir/build.make:62: recipe for target 'CMakeFiles/fastforest.dir/src/fastforest.cpp.o' failed make[2]: [CMakeFiles/fastforest.dir/src/fastforest.cpp.o] Error 1 CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/fastforest.dir/all' failed make[1]: [CMakeFiles/fastforest.dir/all] Error 2 Makefile:140: recipe for target 'all' failed make: ** [all] Error 2 so I tryed to use gcc 7.5.0, install success, but when i use it in #include at main.cpp, a new issue happened, like this: /tmp/ccWRi8pr.o:in ‘main’: main.cpp:(.text+0x232):Undefined reference to ‘FastForest::FastForest(std::cxx11::basic_string<char, std::char_traits, std::allocator > const&, std::vector<std::cxx11::basic_string<char, std::char_traits, std::allocator >, std::allocator<std::__cxx11::basic_string<char, std::char_traits, std::allocator > > >&)’ main.cpp:(.text+0x2ca):Undefined reference to ‘FastForest::operator()(float const) const’ collect2: error: ld returned 1 exit status ` So how I use it, looking forward to your reply!

guitargeek commented 4 years ago

Hi @FanniSun! You probably forgot to link against the fastforest library. Did you install fastforest on your system with make install? Then you can link it just with the -l flag and the library name, like in the benchmark example in the repository [1]:

g++ -o main main.cpp -lfastforest

Please let me know if this works for you so I can close this issue. It is not really a fastforest issue but more C++ help.

[1] https://github.com/guitargeek/XGBoost-FastForest/blob/master/benchmark/benchmark-01.cpp

FanniSun commented 4 years ago

Yes, you are right, thank you very much! !