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

Can't build successfully. #79

Closed Tengyun-Mo closed 3 years ago

Tengyun-Mo commented 3 years ago

I can't build project when I add source code of osqp-eigen to my project. my .pro file is as follows:

QT       += core gui xml

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

TARGET = autocarwin
TEMPLATE = app

CONFIG+= c++11

# The following define makes your compiler emit warnings if you use
# any feature of Qt which has been marked as deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS

INCLUDEPATH+=D:\eigen-3.3.7\Eigen
INCLUDEPATH+=D:\eigen-3.3.7
# INCLUDEPATH+=E:\00-Qt\VS\boost_build\include\boost-1_74
# LIBS += -LE:\00-Qt\VS\boost_build\lib

INCLUDEPATH += /usr/include/eigen3/Eigen

# You can also make your code fail to compile if you use deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0

CONFIG += c++11

SOURCES += \
    ivmapview.cpp \
    ivview.cpp \
        main.cpp \
        mainwindow.cpp \
    kd_tree.cpp \
    mpc_control.cpp \
    myview.cpp \
    mpc.cpp \
    Data.cpp \
    Settings.cpp \
    Solver.cpp

HEADERS += \
    ivmapview.h \
    ivview.h \
        mainwindow.h \
    kd_tree.h \
    mpc_control.h \
    modulecomm.h \
    myview.h

FORMS += \
        mainwindow.ui

# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target

#LIBS += $$PWD/modulecomm1.lib
unix:LIBS += -L$$PWD/../../../bin/  -lmodulecomm

unix:LIBS += -L/usr/local/lib -lipopt

RESOURCES += \
    pic.qrc

INCLUDEPATH +=D:\osqp\include
unix|win32: LIBS += -L$$PWD/./ -lmodulecomm1

INCLUDEPATH += $$PWD/.
DEPENDPATH += $$PWD/.

win32: LIBS += -L$$PWD/../../osqp/build/out/ -losqp

INCLUDEPATH += $$PWD/../../osqp/build/out
DEPENDPATH += $$PWD/../../osqp/build/out
INCLUDEPATH +=D:\osqp-eigen\include
D:\QT\5.6\mingw49_32\bin\qmake.exe -spec win32-g++ "CONFIG+=debug" "CONFIG+=qml_debug" -o Makefile autocarwin.pro
D:/QT/Tools/mingw492_32/bin/mingw32-make -f Makefile.Debug
mingw32-make[1]: Entering directory 'D:/project/autocarwin'
g++ -c -pipe -fno-keep-inline-dllexport -g -std=gnu++0x -frtti -Wall -Wextra -fexceptions -mthreads -DUNICODE -DQT_DEPRECATED_WARNINGS -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_XML_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN -I. -I..\..\eigen-3.3.7\Eigen -I..\..\eigen-3.3.7 -I/usr/include/eigen3/Eigen -I..\..\osqp\include -I. -I..\..\osqp\build\out -I..\..\osqp-eigen\include -I..\..\QT\5.6\mingw49_32\include -I..\..\QT\5.6\mingw49_32\include\QtWidgets -I..\..\QT\5.6\mingw49_32\include\QtGui -I..\..\QT\5.6\mingw49_32\include\QtANGLE -I..\..\QT\5.6\mingw49_32\include\QtXml -I..\..\QT\5.6\mingw49_32\include\QtCore -Idebug -I. -I..\..\QT\5.6\mingw49_32\mkspecs\win32-g++  -o debug\Data.o Data.cpp
g++ -Wl,-subsystem,windows -mthreads -o debug\autocarwin.exe object_script.autocarwin.Debug  -lmingw32 -LD:\QT\5.6\mingw49_32\lib D:\QT\5.6\mingw49_32\lib\libqtmaind.a -lshell32 -LC:\utils\my_sql\my_sql\lib -LC:\utils\postgresql\pgsql\lib -LD:\project\autocarwin -lmodulecomm1 -LD:\osqp\build\out -losqp D:\QT\5.6\mingw49_32\lib\libQt5Widgetsd.a D:\QT\5.6\mingw49_32\lib\libQt5Guid.a D:\QT\5.6\mingw49_32\lib\libQt5Xmld.a D:\QT\5.6\mingw49_32\lib\libQt5Cored.a 
./debug\mpc.o: In function `ZN9OsqpEigen18SparseMatrixHelper22createOsqpSparseMatrixIN5Eigen12SparseMatrixIdLi0EiEEEEbRKNS2_20SparseCompressedBaseIT_EERP3csc':
D:\project\autocarwin/../../osqp-eigen/include/OsqpEigen/SparseMatrixHelper.tpp:32: undefined reference to `csc_spalloc'
./debug\Data.o: In function `ZN9OsqpEigen4Data18clearHessianMatrixEv':
D:\project\autocarwin/Data.cpp:49: undefined reference to `csc_spfree'
./debug\Data.o: In function `ZN9OsqpEigen4Data28clearLinearConstraintsMatrixEv':
D:\project\autocarwin/Data.cpp:58: undefined reference to `csc_spfree'
./debug\Settings.o: In function `ZN9OsqpEigen8SettingsC2Ev':
D:\project\autocarwin/Settings.cpp:16: undefined reference to `osqp_set_default_settings'
./debug\Settings.o: In function `ZN9OsqpEigen8Settings20resetDefaultSettingsEv':
D:\project\autocarwin/Settings.cpp:26: undefined reference to `osqp_set_default_settings'
./debug\Solver.o: In function `ZN9OsqpEigen6Solver20OSQPWorkspaceDeleterEP13OSQPWorkspace':
D:\project\autocarwin/Solver.cpp:18: undefined reference to `osqp_cleanup'
./debug\Solver.o: In function `ZN9OsqpEigen6Solver10initSolverEv':
D:\project\autocarwin/Solver.cpp:90: undefined reference to `osqp_setup'
./debug\Solver.o: In function `ZN9OsqpEigen6Solver5solveEv':
D:\project\autocarwin/Solver.cpp:124: undefined reference to `osqp_solve'
./debug\Solver.o: In function `ZN9OsqpEigen6Solver14updateGradientERKN5Eigen3RefIKNS1_6MatrixIdLin1ELi1ELi0ELin1ELi1EEELi0ENS1_11InnerStrideILi1EEEEE':
D:\project\autocarwin/Solver.cpp:184: undefined reference to `osqp_update_lin_cost'
./debug\Solver.o: In function `ZN9OsqpEigen6Solver16updateLowerBoundERKN5Eigen3RefIKNS1_6MatrixIdLin1ELi1ELi0ELin1ELi1EEELi0ENS1_11InnerStrideILi1EEEEE':
D:\project\autocarwin/Solver.cpp:202: undefined reference to `osqp_update_lower_bound'
./debug\Solver.o: In function `ZN9OsqpEigen6Solver16updateUpperBoundERKN5Eigen3RefIKNS1_6MatrixIdLin1ELi1ELi0ELin1ELi1EEELi0ENS1_11InnerStrideILi1EEEEE':
D:\project\autocarwin/Solver.cpp:221: undefined reference to `osqp_update_upper_bound'
./debug\Solver.o: In function `ZN9OsqpEigen6Solver12updateBoundsERKN5Eigen3RefIKNS1_6MatrixIdLin1ELi1ELi0ELin1ELi1EEELi0ENS1_11InnerStrideILi1EEEEESA_':
D:\project\autocarwin/Solver.cpp:247: undefined reference to `osqp_update_bounds'
collect2.exe: error: ld returned 1 exit status
mingw32-make[1]: *** [debug\autocarwin.exe] Error 1
mingw32-make: *** [debug] Error 2
Makefile.Debug:102: recipe for target 'debug\autocarwin.exe' failed
mingw32-make[1]: Leaving directory 'D:/project/autocarwin'
makefile:34: recipe for target 'debug' failed
11:37:44: 进程"D:\QT\Tools\mingw492_32\bin\mingw32-make.exe"退出,退出代码 2 。
Error while building/deploying project autocarwin (kit: Desktop Qt 5.6.2 MinGW 32bit)
When executing step "Make"
Tengyun-Mo commented 3 years ago

The libosqp.a is 64-bit,and I make the project by mingw32.