robotology / osqp-eigen

Simple Eigen-C++ wrapper for OSQP library
https://robotology.github.io/osqp-eigen/
BSD 3-Clause "New" or "Revised" License
385 stars 114 forks source link

when operator slover class, an error occured, it shows that there is a undefined reference #80

Open lovebugayy opened 3 years ago

lovebugayy commented 3 years ago

CMakeFiles/main.dir/main.cpp.o:in the function‘testQP()’: main.cpp:(.text+0x5b5):for‘OsqpEigen::Solver::Solver()’an undefined reference CMakeFiles/main.dir/main.cpp.o:in the function‘std::default_delete::operator()(OsqpEigen::Settings) const’: main.cpp:(.text._ZNKSt14defaultdeleteIN9OsqpEigen8SettingsEEclEPS1[_ZNKSt14defaultdeleteIN9OsqpEigen8SettingsEEclEPS1]+0x1e):‘OsqpEigen::Settings::~Settings()’an undefined reference CMakeFiles/main.dir/main.cpp.o:in the function‘std::default_delete::operator()(OsqpEigen::Data) const’: main.cpp:(.text._ZNKSt14defaultdeleteIN9OsqpEigen4DataEEclEPS1[_ZNKSt14defaultdeleteIN9OsqpEigen4DataEEclEPS1]+0x1e):‘OsqpEigen::Data::~Data()’an undefined reference collect2: error: ld returned 1 exit status src/CMakeFiles/main.dir/build.make:120: recipe for target '../bin/main' failed make[2]: [../bin/main] Error 1 CMakeFiles/Makefile2:85: recipe for target 'src/CMakeFiles/main.dir/all' failed make[1]: [src/CMakeFiles/main.dir/all] Error 2 Makefile:83: recipe for target 'all' failed make: *** [all] Error 2

S-Dafarra commented 3 years ago

Hi @lovebugayy, could you provide us with more information, like the OS in which you are running, the version you are using, or the application you are running?

GiulioRomualdi commented 3 years ago

Hi @lovebugayy I also suggest you use the following markdown block when you copy the code

``` code you want to show ```

and it will display as

code you want to show 

CMakeFiles/main.dir/main.cpp.o:in the function‘testQP()’:
main.cpp:(.text+0x5b5):for‘OsqpEigen::Solver::Solver()’an undefined reference
CMakeFiles/main.dir/main.cpp.o:in the function‘std::default_delete<OsqpEigen::Settings>::operator()(OsqpEigen::Settings*) const’:
main.cpp:(.text._ZNKSt14default_deleteIN9OsqpEigen8SettingsEEclEPS1_[_ZNKSt14default_deleteIN9OsqpEigen8SettingsEEclEPS1_]+0x1e):‘OsqpEigen::Settings::~Settings()’an undefined reference
CMakeFiles/main.dir/main.cpp.o:in the function‘std::default_delete<OsqpEigen::Data>::operator()(OsqpEigen::Data*) const’:
main.cpp:(.text._ZNKSt14default_deleteIN9OsqpEigen4DataEEclEPS1_[_ZNKSt14default_deleteIN9OsqpEigen4DataEEclEPS1_]+0x1e):‘OsqpEigen::Data::~Data()’an undefined reference
collect2: error: ld returned 1 exit status
src/CMakeFiles/main.dir/build.make:120: recipe for target '../bin/main' failed
make[2]: *** [../bin/main] Error 1
CMakeFiles/Makefile2:85: recipe for target 'src/CMakeFiles/main.dir/all' failed
make[1]: *** [src/CMakeFiles/main.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
lovebugayy commented 3 years ago

Hi, thanks for your advise. In fact, it's a very simple code. When i use the class OsqpEigen, errors occur, it shows an undefined reference. but i don't know why and where should be changed.

OsqpEigen::Solver solver;