2017-03-23 55 views
0

我試過以下說post。但我仍然有錯誤錯誤:undefined參考'engOpen'在Qt

我想連接Matlab與QT。我使用的是Qt Creator 4.2和QT 5.8。這是我在我的.pro文件中。

QT  += core gui serialport axcontainer 

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets 

TARGET = Totem_app 
TEMPLATE = app 

# The following define makes your compiler emit warnings if you use 
# any feature of Qt which as 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 


SOURCES += main.cpp\ 
     mainwindow.cpp 

HEADERS += mainwindow.h 

FORMS += mainwindow.ui 

CONFIG+=c++11 


win32:CONFIG(release, debug|release): LIBS += -L'C:/Program Files/MATLAB/R2016b/extern/lib/win64/microsoft/' -llibmx 
else:win32:CONFIG(debug, debug|release): LIBS += -L'C:/Program Files/MATLAB/R2016b/extern/lib/win64/microsoft/' -llibmxd 

INCLUDEPATH += 'C:/Program Files/MATLAB/R2016b/extern/lib/win64/microsoft' 
DEPENDPATH += 'C:/Program Files/MATLAB/R2016b/extern/lib/win64/microsoft' 

我還包括頭文件。

#include <QFileDialog> 
#include <QtPlugin> 
#include "mainwindow.h" 
#include "ui_mainwindow.h" 
#include <QThread> 
#include <QTextCodec> 
#include "C:\Program Files\MATLAB\R2016b\extern\include\engine.h" 

有人能幫我解決這個問題嗎?我怎麼能包含engine.h而不提供整個路徑目錄?我做錯了,我得到未定義的參考錯誤?所有的幫助是高度讚賞它。

回答

0

要包括engine.h不完整的路徑,添加另一個包含這樣的路徑:
INCLUDEPATH += 'C:/Program Files/MATLAB/R2016b/extern/include/'

未定義的參考,如您鏈接的帖子解釋,意味着你缺少指定哪個庫需要聲明被鏈接。

here我看到,雖然您已經列出了libmx,但您還需要添加libeng