-
Notifications
You must be signed in to change notification settings - Fork 330
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
undefined reference to `matplot::gca()' #388
Comments
I have the same issue |
Same issue here, with both gca() and gcf(), though I'm on Windows 11. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Bug category
Describe the bug
I installed matplotplusplus using the following instructions from the official guide
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="-O2" -DMATPLOTPP_BUILD_EXAMPLES=OFF -DMATPLOTPP_BUILD_TESTS=OFF
sudo cmake --build . --parallel 2 --config Release
sudo cmake --install .
on Ubuntu 22.04 system with g++ 12 and cmake 3.22 under Eclipse 2023-12 IDE
Steps to Reproduce
just create a new cmake project with defaults, create a simple default project with the following code
#include
#include <matplot/matplot.h>
#include
#include
int main(int argc, char **argv) {
}
and build it.
Output
Building in: /home/user/workspace-cpp/Project-Cmake/build/default
cmake --build . --target all
[ 50%] Linking CXX executable Project-Cmake
/usr/bin/ld: CMakeFiles/Project-Cmake.dir/Project-Cmake.cpp.o: in function
auto matplot::plot<std::vector<int, std::allocator<int> >>(std::vector<int, std::allocator<int> >)': Project-Cmake.cpp:(.text._ZN7matplot4plotISt6vectorIiSaIiEEJEEEDaT_DpOT0_[_ZN7matplot4plotISt6vectorIiSaIiEEJEEEDaT_DpOT0_]+0x2c): undefined reference to
matplot::gca()'/usr/bin/ld: CMakeFiles/Project-Cmake.dir/Project-Cmake.cpp.o: in function
std::shared_ptr<matplot::line> matplot::axes_type::plot<std::vector<int, std::allocator<int> > >(std::vector<int, std::allocator<int> > const&, std::basic_string_view<char, std::char_traits<char> >)': Project-Cmake.cpp:(.text._ZN7matplot9axes_type4plotISt6vectorIiSaIiEEEESt10shared_ptrINS_4lineEERKT_St17basic_string_viewIcSt11char_traitsIcEE[_ZN7matplot9axes_type4plotISt6vectorIiSaIiEEEESt10shared_ptrINS_4lineEERKT_St17basic_string_viewIcSt11char_traitsIcEE]+0x67): undefined reference to
matplot::axes_type::plot(std::vector<double, std::allocator > const&, std::basic_string_view<char, std::char_traits >)'collect2: error: ld returned 1 exit status
gmake[2]: *** [CMakeFiles/Project-Cmake.dir/build.make:97: Project-Cmake] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:83: CMakeFiles/Project-Cmake.dir/all] Error 2
gmake: *** [Makefile:91: all] Error 2
Build complete (5 errors, 0 warnings): /home/user/workspace-cpp/Project-Cmake/build/default
Platform
Environment Details:
Additional context
The text was updated successfully, but these errors were encountered: