getting lnk2019 error when compile a program using qt creator and eigen library

半世苍凉 提交于 2020-01-05 05:27:10

问题


I try to compile a project in qt and after i link the necessary libs i ghet the fallowing linking error :

labelbox.obj:-1: error: LNK2019: unresolved external symbol "public: void __thiscall LabelImage::setAxis(class Eigen::Matrix<double,4,4,0,4,4>)" (?setAxis@LabelImage@@QAEXV?$Matrix@N$03$03$0A@$03$03@Eigen@@@Z) referenced in function "public: void __thiscall ImageView::setRotMat(class Eigen::Matrix<double,4,4,0,4,4> &)" (?setRotMat@ImageView@@QAEXAAV?$Matrix@N$03$03$0A@$03$03@Eigen@@@Z)

If i go in the matrix.h from eigen i see the next problems : In the fallowing lines of code :

 template<typename _Scalar, int _Rows, int _Cols, int _Options, int _MaxRows, int _MaxCols>
class Matrix
  : public PlainObjectBase<Matrix<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols> >
{
  public:

    /** \brief Base class typedef.
      * \sa PlainObjectBase
      */
    typedef PlainObjectBase<Matrix> Base;

    enum { Options = _Options };

    EIGEN_DENSE_PUBLIC_INTERFACE(Matrix)

    typedef typename Base::PlainObject PlainObject;

    using Base::base;
    using Base::coeffRef;

    /**
      * \brief Assigns matrices to each other.
      *
      * \note This is a special case of the templated operator=. Its purpose is
      * to prevent a default operator= from hiding the templated operator=.
      *
      * \callgraph
      */
    EIGEN_DEVICE_FUNC
    EIGEN_STRONG_INLINE Matrix& operator=(const Matrix& other)
    {
      return Base::_set(other);
    }

    /** \internal
      * \brief Copies the value of the expression \a other into \c *this with automatic resizing.
      *
      * *this might be resized to match the dimensions of \a other. If *this was a null matrix (not already initialized),
      * it will be initialized.
      *
      * Note that copying a row-vector into a vector (and conversely) is allowed.
      * The resizing, if any, is then done in the appropriate way so that row-vectors
      * remain row-vectors and vectors remain vectors.
      */
    template<typename OtherDerived>
    EIGEN_DEVICE_FUNC
    EIGEN_STRONG_INLINE Matrix& operator=(const DenseBase<OtherDerived>& other)
    {
      return Base::_set(other);
    }

    /* Here, doxygen failed to copy the brief information when using \copydoc */

    /**
      * \brief Copies the generic expression \a other into *this.
      * \copydetails DenseBase::operator=(const EigenBase<OtherDerived> &other)
      */
    template<typename OtherDerived>
    EIGEN_DEVICE_FUNC
    EIGEN_STRONG_INLINE Matrix& operator=(const EigenBase<OtherDerived> &other)
    {
      return Base::operator=(other);
    }

    template<typename OtherDerived>
    EIGEN_DEVICE_FUNC
    EIGEN_STRONG_INLINE Matrix& operator=(const ReturnByValue<OtherDerived>& func)
    {
      return Base::operator=(func);
    }

    /** \brief Default constructor.
      *
      * For fixed-size matrices, does nothing.
      *
      * For dynamic-size matrices, creates an empty matrix of size 0. Does not allocate any array. Such a matrix
      * is called a null matrix. This constructor is the unique way to create null matrices: resizing
      * a matrix to 0 is not supported.
      *
      * \sa resize(Index,Index)
      */
    EIGEN_DEVICE_FUNC
    EIGEN_STRONG_INLINE Matrix() : Base()
    {
      Base::_check_template_params();
      EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED
    }

    // FIXME is it still needed
    EIGEN_DEVICE_FUNC
    explicit Matrix(internal::constructor_without_unaligned_array_assert)
      : Base(internal::constructor_without_unaligned_array_assert())
    { Base::_check_template_params(); EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED }

#if EIGEN_HAS_RVALUE_REFERENCES
    EIGEN_DEVICE_FUNC
    Matrix(Matrix&& other) EIGEN_NOEXCEPT_IF(std::is_nothrow_move_constructible<Scalar>::value)
      : Base(std::move(other))
    {
      Base::_check_template_params();
      if (RowsAtCompileTime!=Dynamic && ColsAtCompileTime!=Dynamic)
        Base::_set_noalias(other);
    }
    EIGEN_DEVICE_FUNC
    Matrix& operator=(Matrix&& other) EIGEN_NOEXCEPT_IF(std::is_nothrow_move_assignable<Scalar>::value)
    {
      other.swap(*this);
      return *this;
    }
#endif

    #ifndef EIGEN_PARSED_BY_DOXYGEN

    // This constructor is for both 1x1 matrices and dynamic vectors
    template<typename T>
    EIGEN_DEVICE_FUNC
    EIGEN_STRONG_INLINE explicit Matrix(const T& x)
    {
      Base::_check_template_params();
      Base::template _init1<T>(x);
    }

    template<typename T0, typename T1>
    EIGEN_DEVICE_FUNC
    EIGEN_STRONG_INLINE Matrix(const T0& x, const T1& y)
    {
      Base::_check_template_params();
      Base::template _init2<T0,T1>(x, y);
    }
    #else
    /** \brief Constructs a fixed-sized matrix initialized with coefficients starting at \a data */
    EIGEN_DEVICE_FUNC
    explicit Matrix(const Scalar *data);

    /** \brief Constructs a vector or row-vector with given dimension. \only_for_vectors
      *
      * This is useful for dynamic-size vectors. For fixed-size vectors,
      * it is redundant to pass these parameters, so one should use the default constructor
      * Matrix() instead.
      * 
      * \warning This constructor is disabled for fixed-size \c 1x1 matrices. For instance,
      * calling Matrix<double,1,1>(1) will call the initialization constructor: Matrix(const Scalar&).
      * For fixed-size \c 1x1 matrices it is therefore recommended to use the default
      * constructor Matrix() instead, especially when using one of the non standard
      * \c EIGEN_INITIALIZE_MATRICES_BY_{ZERO,\c NAN} macros (see \ref TopicPreprocessorDirectives).
      */
    EIGEN_STRONG_INLINE explicit Matrix(Index dim);
    /** \brief Constructs an initialized 1x1 matrix with the given coefficient */
    Matrix(const Scalar& x);
    /** \brief Constructs an uninitialized matrix with \a rows rows and \a cols columns.
      *
      * This is useful for dynamic-size matrices. For fixed-size matrices,
      * it is redundant to pass these parameters, so one should use the default constructor
      * Matrix() instead.
      * 
      * \warning This constructor is disabled for fixed-size \c 1x2 and \c 2x1 vectors. For instance,
      * calling Matrix2f(2,1) will call the initialization constructor: Matrix(const Scalar& x, const Scalar& y).
      * For fixed-size \c 1x2 or \c 2x1 vectors it is therefore recommended to use the default
      * constructor Matrix() instead, especially when using one of the non standard
      * \c EIGEN_INITIALIZE_MATRICES_BY_{ZERO,\c NAN} macros (see \ref TopicPreprocessorDirectives).
      */
    EIGEN_DEVICE_FUNC
    Matrix(Index rows, Index cols);

    /** \brief Constructs an initialized 2D vector with given coefficients */
    Matrix(const Scalar& x, const Scalar& y);
    #endif

    /** \brief Constructs an initialized 3D vector with given coefficients */
    EIGEN_DEVICE_FUNC
    EIGEN_STRONG_INLINE Matrix(const Scalar& x, const Scalar& y, const Scalar& z)
    {
      Base::_check_template_params();
      EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(Matrix, 3)
      m_storage.data()[0] = x;
      m_storage.data()[1] = y;
      m_storage.data()[2] = z;
    }
    /** \brief Constructs an initialized 4D vector with given coefficients */
    EIGEN_DEVICE_FUNC
    EIGEN_STRONG_INLINE Matrix(const Scalar& x, const Scalar& y, const Scalar& z, const Scalar& w)
    {
      Base::_check_template_params();
      EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(Matrix, 4)
      m_storage.data()[0] = x;
      m_storage.data()[1] = y;
      m_storage.data()[2] = z;
      m_storage.data()[3] = w;
    }


    /** \brief Copy constructor */
    EIGEN_DEVICE_FUNC
    EIGEN_STRONG_INLINE Matrix(const Matrix& other) : Base(other)
    { }

    /** \brief Copy constructor for generic expressions.
      * \sa MatrixBase::operator=(const EigenBase<OtherDerived>&)
      */
    template<typename OtherDerived>
    EIGEN_DEVICE_FUNC
    EIGEN_STRONG_INLINE Matrix(const EigenBase<OtherDerived> &other)
      : Base(other.derived())
    { }

    EIGEN_DEVICE_FUNC inline Index innerStride() const { return 1; }
    EIGEN_DEVICE_FUNC inline Index outerStride() const { return this->innerSize(); }

    /////////// Geometry module ///////////

    template<typename OtherDerived>
    EIGEN_DEVICE_FUNC
    explicit Matrix(const RotationBase<OtherDerived,ColsAtCompileTime>& r);
    template<typename OtherDerived>
    EIGEN_DEVICE_FUNC
    Matrix& operator=(const RotationBase<OtherDerived,ColsAtCompileTime>& r);

    // allow to extend Matrix outside Eigen
    #ifdef EIGEN_MATRIX_PLUGIN
    #include EIGEN_MATRIX_PLUGIN
    #endif

  protected:
    template <typename Derived, typename OtherDerived, bool IsVector>
    friend struct internal::conservative_resize_like_impl;

    using Base::m_storage;
};

/** \defgroup matrixtypedefs Global matrix typedefs
  *
  * \ingroup Core_Module
  *
  * Eigen defines several typedef shortcuts for most common matrix and vector types.
  *
  * The general patterns are the following:
  *
  * \c MatrixSizeType where \c Size can be \c 2,\c 3,\c 4 for fixed size square matrices or \c X for dynamic size,
  * and where \c Type can be \c i for integer, \c f for float, \c d for double, \c cf for complex float, \c cd
  * for complex double.
  *
  * For example, \c Matrix3d is a fixed-size 3x3 matrix type of doubles, and \c MatrixXf is a dynamic-size matrix of floats.
  *
  * There are also \c VectorSizeType and \c RowVectorSizeType which are self-explanatory. For example, \c Vector4cf is
  * a fixed-size vector of 4 complex floats.
  *
  * \sa class Matrix
  */

#define EIGEN_MAKE_TYPEDEFS(Type, TypeSuffix, Size, SizeSuffix)   \
/** \ingroup matrixtypedefs */                                    \
typedef Matrix<Type, Size, Size> Matrix##SizeSuffix##TypeSuffix;  \
/** \ingroup matrixtypedefs */                                    \
typedef Matrix<Type, Size, 1>    Vector##SizeSuffix##TypeSuffix;  \
/** \ingroup matrixtypedefs */                                    \
typedef Matrix<Type, 1, Size>    RowVector##SizeSuffix##TypeSuffix;

#define EIGEN_MAKE_FIXED_TYPEDEFS(Type, TypeSuffix, Size)         \
/** \ingroup matrixtypedefs */                                    \
typedef Matrix<Type, Size, Dynamic> Matrix##Size##X##TypeSuffix;  \
/** \ingroup matrixtypedefs */                                    \
typedef Matrix<Type, Dynamic, Size> Matrix##X##Size##TypeSuffix;

#define EIGEN_MAKE_TYPEDEFS_ALL_SIZES(Type, TypeSuffix) \
EIGEN_MAKE_TYPEDEFS(Type, TypeSuffix, 2, 2) \
EIGEN_MAKE_TYPEDEFS(Type, TypeSuffix, 3, 3) \
EIGEN_MAKE_TYPEDEFS(Type, TypeSuffix, 4, 4) \
EIGEN_MAKE_TYPEDEFS(Type, TypeSuffix, Dynamic, X) \
EIGEN_MAKE_FIXED_TYPEDEFS(Type, TypeSuffix, 2) \
EIGEN_MAKE_FIXED_TYPEDEFS(Type, TypeSuffix, 3) \
EIGEN_MAKE_FIXED_TYPEDEFS(Type, TypeSuffix, 4)

EIGEN_MAKE_TYPEDEFS_ALL_SIZES(int,                  i)
EIGEN_MAKE_TYPEDEFS_ALL_SIZES(float,                f)
EIGEN_MAKE_TYPEDEFS_ALL_SIZES(double,               d)
EIGEN_MAKE_TYPEDEFS_ALL_SIZES(std::complex<float>,  cf)
EIGEN_MAKE_TYPEDEFS_ALL_SIZES(std::complex<double>, cd)

#undef EIGEN_MAKE_TYPEDEFS_ALL_SIZES
#undef EIGEN_MAKE_TYPEDEFS
#undef EIGEN_MAKE_FIXED_TYPEDEFS

} // end namespace Eigen

#endif // EIGEN_MATRIX_H

I got the next errors :

 D:\toolchain-master\LabelingTool\Dependencies\build_dir\include\eigen3\Eigen\src\Core\Matrix.h:18: error: use of undeclared identifier 'Matrix'
D:\toolchain-master\LabelingTool\Dependencies\build_dir\include\eigen3\Eigen\src\Core\Matrix.h:18: error: '_Scalar' does not refer to a value
  D:\toolchain-master\LabelingTool\Dependencies\build_dir\include\eigen3\Eigen\src\Core\Matrix.h:18: error: explicit specialization of non-template struct 'traits'
D:\toolchain-master\LabelingTool\Dependencies\build_dir\include\eigen3\Eigen\src\Core\Matrix.h:179: error: unknown template name 'PlainObjectBase'
D:\toolchain-master\LabelingTool\Dependencies\build_dir\include\eigen3\Eigen\src\Core\Matrix.h:186: error: no template named 'PlainObjectBase'
D:\toolchain-master\LabelingTool\Dependencies\build_dir\include\eigen3\Eigen\src\Core\Matrix.h:190: error: expected ';' at end of declaration list
D:\toolchain-master\LabelingTool\Dependencies\build_dir\include\eigen3\Eigen\src\Core\Matrix.h:194: error: 'Eigen::Matrix::Base' (aka 'int') is not a class, namespace, or enumeration
D:\toolchain-master\LabelingTool\Dependencies\build_dir\include\eigen3\Eigen\src\Core\Matrix.h:205: error: unknown type name 'EIGEN_DEVICE_FUNC'
D:\toolchain-master\LabelingTool\Dependencies\build_dir\include\eigen3\Eigen\src\Core\Matrix.h:450: error: too few template arguments for class template 'Matrix'
................................................

I don't know if i link the library correctly , here is my .pro folder :

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
QT       += core gui charts

TARGET = LabelingTool
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

# 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



INCLUDEPATH += /usr/local/include/
LIBS += -L/usr/local/lib64 -losg -losgDB -losgGA -losgViewer -losgText
# LIBS += D:/Qt/5.11.2/msvc2015/ -llibEGL -llibGLESv2 -lQt5AccessibilitySupport -lQt5AxBase -lQt5AxContainer -lQt5AxServer -lQt5Bluetooth -lQt5Bootstrap -lQt5Charts -lQt5Concurrent
SOURCES += \
        src/main.cpp \
        src/MainWindow/mainwindow.cpp \
        src/MainOsgViewer/mainosgviewer.cpp \
        src/LabelData/labeldata.cpp \
        src/LabelEventHandler/labeleventhandler.cpp \
        src/ImageView/imageview.cpp \
        src/InformationFormular/informationformular.cpp \
        src/Polynomial/polynomial.cpp \
        src/Chart/chart.cpp \
        src/LabelImage/labelimage.cpp \
        src/YamlReader/yamlreader.cpp \
        src/LabelBox/labelbox.cpp \
        src/SliderBar/sliderbar.cpp \
        src/LabelData/labeldata.cpp \



HEADERS += \
        src/MainWindow/mainwindow.h \
        src/MainOsgViewer/mainosgviewer.h \
        src/LabelData/labeldata.h \
        src/LabelEventHandler/labeleventhandler.h \
        src/ImageView/imageview.h \
        src/InformationFormular/informationformular.h \
        src/Polynomial/polynomial.h \
        src/Chart/chart.h \
        src/LabelImage/labelimage.h \
        src/YamlReader/yamlreader.h \
        src/LabelBox/labelbox.h \
        src/SliderBar/sliderbar.h \
        src/LabelData/labeldata.h \
        Dependencies/build_dir/include/eigen3/Eigen/src/Core/Matrix.h \


DISTFILES += \
   CMakeLists.txt

win32:CONFIG(release, debug|release): LIBS += -L$$PWD/Dependencies/OSG.3.4.0/lib/ -lOpenThreads \
else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/Dependencies/OSG.3.4.0/lib/ -lOpenThreadsd \
else:unix: LIBS += -L$$PWD/Dependencies/OSG.3.4.0/lib/ -lOpenThreads \

INCLUDEPATH += $$PWD/Dependencies/OSG.3.4.0/include \
DEPENDPATH += $$PWD/Dependencies/OSG.3.4.0/include  \

win32:CONFIG(release, debug|release): LIBS += -L$$PWD/Dependencies/OSG.3.4.0/lib/ -losgAnimation
else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/Dependencies/OSG.3.4.0/lib/ -losgAnimationd
else:unix: LIBS += -L$$PWD/Dependencies/OSG.3.4.0/lib/ -losgAnimation

INCLUDEPATH += $$PWD/Dependencies/OSG.3.4.0/include
DEPENDPATH += $$PWD/Dependencies/OSG.3.4.0/include

win32:CONFIG(release, debug|release): LIBS += -L$$PWD/Dependencies/OSG.3.4.0/lib/ -losg
else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/Dependencies/OSG.3.4.0/lib/ -losgd
else:unix: LIBS += -L$$PWD/Dependencies/OSG.3.4.0/lib/ -losg

INCLUDEPATH += $$PWD/Dependencies/OSG.3.4.0/include
DEPENDPATH += $$PWD/Dependencies/OSG.3.4.0/include

win32:CONFIG(release, debug|release): LIBS += -L$$PWD/Dependencies/OSG.3.4.0/lib/ -losgDB
else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/Dependencies/OSG.3.4.0/lib/ -losgDBd
else:unix: LIBS += -L$$PWD/Dependencies/OSG.3.4.0/lib/ -losgDB

INCLUDEPATH += $$PWD/Dependencies/OSG.3.4.0/include
DEPENDPATH += $$PWD/Dependencies/OSG.3.4.0/include



win32:CONFIG(release, debug|release): LIBS += -L$$PWD/Dependencies/OSG.3.4.0/lib/ -losgFX
else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/Dependencies/OSG.3.4.0/lib/ -losgFXd
else:unix: LIBS += -L$$PWD/Dependencies/OSG.3.4.0/lib/ -losgFX

INCLUDEPATH += $$PWD/Dependencies/OSG.3.4.0/include
DEPENDPATH += $$PWD/Dependencies/OSG.3.4.0/include



win32:CONFIG(release, debug|release): LIBS += -L$$PWD/Dependencies/OSG.3.4.0/lib/ -losgManipulator
else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/Dependencies/OSG.3.4.0/lib/ -losgManipulatord
else:unix: LIBS += -L$$PWD/Dependencies/OSG.3.4.0/lib/ -losgManipulator

INCLUDEPATH += $$PWD/Dependencies/OSG.3.4.0/include
DEPENDPATH += $$PWD/Dependencies/OSG.3.4.0/include




win32:CONFIG(release, debug|release): LIBS += -L$$PWD/Dependencies/OSG.3.4.0/lib/ -losgParticle
else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/Dependencies/OSG.3.4.0/lib/ -losgParticled
else:unix: LIBS += -L$$PWD/Dependencies/OSG.3.4.0/lib/ -losgParticle

INCLUDEPATH += $$PWD/Dependencies/OSG.3.4.0/include
DEPENDPATH += $$PWD/Dependencies/OSG.3.4.0/include

win32:CONFIG(release, debug|release): LIBS += -L$$PWD/Dependencies/OSG.3.4.0/lib/ -losgPresentation
else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/Dependencies/OSG.3.4.0/lib/ -losgPresentationd
else:unix: LIBS += -L$$PWD/Dependencies/OSG.3.4.0/lib/ -losgPresentation

INCLUDEPATH += $$PWD/Dependencies/OSG.3.4.0/include
DEPENDPATH += $$PWD/Dependencies/OSG.3.4.0/include

win32:CONFIG(release, debug|release): LIBS += -L$$PWD/Dependencies/OSG.3.4.0/lib/ -losgShadow
else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/Dependencies/OSG.3.4.0/lib/ -losgShadowd
else:unix: LIBS += -L$$PWD/Dependencies/OSG.3.4.0/lib/ -losgShadow

INCLUDEPATH += $$PWD/Dependencies/OSG.3.4.0/include
DEPENDPATH += $$PWD/Dependencies/OSG.3.4.0/include

win32:CONFIG(release, debug|release): LIBS += -L$$PWD/Dependencies/OSG.3.4.0/lib/ -losgSim
else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/Dependencies/OSG.3.4.0/lib/ -losgSimd
else:unix: LIBS += -L$$PWD/Dependencies/OSG.3.4.0/lib/ -losgSim

INCLUDEPATH += $$PWD/Dependencies/OSG.3.4.0/include
DEPENDPATH += $$PWD/Dependencies/OSG.3.4.0/include

win32:CONFIG(release, debug|release): LIBS += -L$$PWD/Dependencies/OSG.3.4.0/lib/ -losgTerrain
else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/Dependencies/OSG.3.4.0/lib/ -losgTerraind
else:unix: LIBS += -L$$PWD/Dependencies/OSG.3.4.0/lib/ -losgTerrain

INCLUDEPATH += $$PWD/Dependencies/OSG.3.4.0/include
DEPENDPATH += $$PWD/Dependencies/OSG.3.4.0/include

win32:CONFIG(release, debug|release): LIBS += -L$$PWD/Dependencies/OSG.3.4.0/lib/ -losgText
else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/Dependencies/OSG.3.4.0/lib/ -losgTextd
else:unix: LIBS += -L$$PWD/Dependencies/OSG.3.4.0/lib/ -losgText

INCLUDEPATH += $$PWD/Dependencies/OSG.3.4.0/include
DEPENDPATH += $$PWD/Dependencies/OSG.3.4.0/include

win32:CONFIG(release, debug|release): LIBS += -L$$PWD/Dependencies/OSG.3.4.0/lib/ -losgUI
else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/Dependencies/OSG.3.4.0/lib/ -losgUId
else:unix: LIBS += -L$$PWD/Dependencies/OSG.3.4.0/lib/ -losgUI

INCLUDEPATH += $$PWD/Dependencies/OSG.3.4.0/include
DEPENDPATH += $$PWD/Dependencies/OSG.3.4.0/include

win32:CONFIG(release, debug|release): LIBS += -L$$PWD/Dependencies/OSG.3.4.0/lib/ -losgUtil
else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/Dependencies/OSG.3.4.0/lib/ -losgUtild
else:unix: LIBS += -L$$PWD/Dependencies/OSG.3.4.0/lib/ -losgUtil

INCLUDEPATH += $$PWD/Dependencies/OSG.3.4.0/include
DEPENDPATH += $$PWD/Dependencies/OSG.3.4.0/include

win32:CONFIG(release, debug|release): LIBS += -L$$PWD/Dependencies/OSG.3.4.0/lib/ -losgViewer
else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/Dependencies/OSG.3.4.0/lib/ -losgViewerd
else:unix: LIBS += -L$$PWD/Dependencies/OSG.3.4.0/lib/ -losgViewer

INCLUDEPATH += $$PWD/Dependencies/OSG.3.4.0/include
DEPENDPATH += $$PWD/Dependencies/OSG.3.4.0/include

win32:CONFIG(release, debug|release): LIBS += -L$$PWD/Dependencies/OSG.3.4.0/lib/ -losgVolume
else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/Dependencies/OSG.3.4.0/lib/ -losgVolumed
else:unix: LIBS += -L$$PWD/Dependencies/OSG.3.4.0/lib/ -losgVolume

INCLUDEPATH += $$PWD/Dependencies/OSG.3.4.0/include
DEPENDPATH += $$PWD/Dependencies/OSG.3.4.0/include

win32:CONFIG(release, debug|release): LIBS += -L$$PWD/Dependencies/OSG.3.4.0/lib/ -losgWidget
else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/Dependencies/OSG.3.4.0/lib/ -losgWidgetd
else:unix: LIBS += -L$$PWD/Dependencies/OSG.3.4.0/lib/ -losgWidget

INCLUDEPATH += $$PWD/Dependencies/OSG.3.4.0/include
DEPENDPATH += $$PWD/Dependencies/OSG.3.4.0/include

win32:CONFIG(release, debug|release): LIBS += -L$$PWD/Dependencies/OSG.3.4.0/lib/ -losgGA
else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/Dependencies/OSG.3.4.0/lib/ -losgGAd
else:unix: LIBS += -L$$PWD/Dependencies/OSG.3.4.0/lib/ -losgGA

INCLUDEPATH += $$PWD/Dependencies/OSG.3.4.0/include
DEPENDPATH += $$PWD/Dependencies/OSG.3.4.0/include

INCLUDEPATH += $$PWD/Dependencies/eigen-eigen
DEPENDPATH += $$PWD/Dependencies/eigen-eigen


win32:CONFIG(release, debug|release): LIBS += -L$$PWD/Dependencies/yaml-cpp-masterr/lib/ -llibyaml-cppmd
else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/Dependencies/yaml-cpp-masterr/lib/ -llibyaml-cppmdd
else:unix: LIBS += -L$$PWD/Dependencies/yaml-cpp-masterr/lib/ -llibyaml-cppmd

INCLUDEPATH += $$PWD/Dependencies/yaml-cpp-masterr/include
DEPENDPATH += $$PWD/Dependencies/yaml-cpp-masterr/include

win32:CONFIG(release, debug|release): LIBS += -L$$PWD/Dependencies/OSG.3.4.0/lib/ -losg
else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/Dependencies/OSG.3.4.0/lib/ -losgd
else:unix: LIBS += -L$$PWD/Dependencies/OSG.3.4.0/lib/ -losg

INCLUDEPATH += $$PWD/Dependencies/OSG.3.4.0/include
DEPENDPATH += $$PWD/Dependencies/OSG.3.4.0/include

win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../../Qt/5.11.2/msvc2015/lib/ -lQt5Core
else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../Qt/5.11.2/msvc2015/lib/ -lQt5Cored
else:unix: LIBS += -L$$PWD/../../Qt/5.11.2/msvc2015/lib/ -lQt5Core

INCLUDEPATH += $$PWD/../../Qt/5.11.2/msvc2015/include
DEPENDPATH += $$PWD/../../Qt/5.11.2/msvc2015/include

win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../../Qt/5.11.2/msvc2015/lib/ -lQt5Gui
else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../Qt/5.11.2/msvc2015/lib/ -lQt5Guid
else:unix: LIBS += -L$$PWD/../../Qt/5.11.2/msvc2015/lib/ -lQt5Gui

INCLUDEPATH += $$PWD/../../Qt/5.11.2/msvc2015/include
DEPENDPATH += $$PWD/../../Qt/5.11.2/msvc2015/include

win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../../Qt/5.11.2/msvc2015/lib/ -lQt5Svg
else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../Qt/5.11.2/msvc2015/lib/ -lQt5Svgd
else:unix: LIBS += -L$$PWD/../../Qt/5.11.2/msvc2015/lib/ -lQt5Svg

INCLUDEPATH += $$PWD/../../Qt/5.11.2/msvc2015/include
DEPENDPATH += $$PWD/../../Qt/5.11.2/msvc2015/include

win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../../Qt/5.11.2/msvc2015/lib/ -lQt5Widgets
else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../Qt/5.11.2/msvc2015/lib/ -lQt5Widgetsd
else:unix: LIBS += -L$$PWD/../../Qt/5.11.2/msvc2015/lib/ -lQt5Widgets

INCLUDEPATH += $$PWD/../../Qt/5.11.2/msvc2015/include
DEPENDPATH += $$PWD/../../Qt/5.11.2/msvc2015/include

win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../../Qt/5.11.2/msvc2015/lib/ -lQt5Script
else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../Qt/5.11.2/msvc2015/lib/ -lQt5Scriptd
else:unix: LIBS += -L$$PWD/../../Qt/5.11.2/msvc2015/lib/ -lQt5Script

INCLUDEPATH += $$PWD/../../Qt/5.11.2/msvc2015/lib
DEPENDPATH += $$PWD/../../Qt/5.11.2/msvc2015/lib

win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../../Qt/5.11.2/msvc2015/lib/ -lqtmain
else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../Qt/5.11.2/msvc2015/lib/ -lqtmaind
else:unix: LIBS += -L$$PWD/../../Qt/5.11.2/msvc2015/lib/ -lqtmain

INCLUDEPATH += $$PWD/../../Qt/5.11.2/msvc2015/lib
DEPENDPATH += $$PWD/../../Qt/5.11.2/msvc2015/lib

win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../../Qt/5.11.2/msvc2015/lib/ -lQt5QuickWidgets
else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../Qt/5.11.2/msvc2015/lib/ -lQt5QuickWidgetsd
else:unix: LIBS += -L$$PWD/../../Qt/5.11.2/msvc2015/lib/ -lQt5QuickWidgets

INCLUDEPATH += $$PWD/../../Qt/5.11.2/msvc2015/include
DEPENDPATH += $$PWD/../../Qt/5.11.2/msvc2015/include

.................................................................................


回答1:


I don't use qt, so take this with a grain of salt. You have two possible issues that I see:

  1. In the
    HEADERS += \ .... Dependencies/build_dir/include/eigen3/Eigen/src/Core/Matrix.h \
    I think you shoud be using Dependencies/build_dir/include/eigen3/Eigen/Core instead.
  2. The lines:
    INCLUDEPATH += $$PWD/Dependencies/eigen-eigen DEPENDPATH += $$PWD/Dependencies/eigen-eigen
    seem to have a different path than the included path in item '1' above. This may not be an issue if the two directories are identical, but if not, you'll have version mismatch issues.


来源:https://stackoverflow.com/questions/52733884/getting-lnk2019-error-when-compile-a-program-using-qt-creator-and-eigen-library

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!