Qt5使用第三方庫(GSL2.5) ~ QT5_Use_GSL
資料來源:https://blog.csdn.net/ouening/article/details/100102331
https://www.youtube.com/watch?v=AoEb6QRn8QY
WINDOWS下的LIMUX命令工具列(包含ldd 可偵測X64):
https://blog.miniasp.com/post/2015/09/27/Useful-tool-Cmder
https://cmder.net/
GITHUB: https://github.com/jash-git/QT5_Use_GSL
★將第三方函示庫(函數庫/函式庫)引用(整合)到QT專案之中
Code:
#gsl.pri #相關檔案來源:C:\Qt\Qt5.12.11\Tools\mingw730_64\msys\local # 宏定义项,指明采用GSL DEFINES += GSL_DLL # 指明GSL库所对应的头文件所在目录 INCLUDEPATH += $$PWD/include # 指明依赖库关系 LIBS += -L$$PWD/lib -lgsl LIBS += -L$$PWD/lib -lgslcblas
#QT5_Use_GSL.pro QT -= gui include($$PWD/gsl/gsl.pri) CONFIG += c++11 console CONFIG -= app_bundle # You can make your code fail to compile if it uses deprecated APIs. # In order to do so, uncomment the following line. #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 SOURCES += \ main.cpp # Default rules for deployment. qnx: target.path = /tmp/$${TARGET}/bin else: unix:!android: target.path = /opt/$${TARGET}/bin !isEmpty(target.path): INSTALLS += target
//main.cpp #include#include #include #include void Pause() { printf("Press Enter key to continue ..."); fgetc(stdin); } int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); double x = 5.0; double y = gsl_sf_bessel_J0 (x); printf ("J0(%g) = %.18e\n", x, y); //qDebug()<< "J0(%g) = %.18e\n", x, y; Pause(); return 0;//return a.exec(); }
結果圖: