gsl eclipse
1 我的gsl安裝路徑:D:/GnuWin32
1 eclipse 新建c++ project Helloworld類型的工程,取名gsl_test;
2 設(shè)置工程屬性,將gsl 添加到工程中。
??? 2.1 project-->properties--->C/C++ builder--->GCC C++ complier --->Includes
??????? 添加"D:/GnuWin32/include"
??? 2.2 project-->properties--->C/C++ builder--->GCC complier --->Includes
?添加"D:/GnuWin32/include"
??? 2.3 project-->properties--->C/C++ builder---> MinGW C++ Linker---->Libraries
??????? 2.3.1 在libraries(-l)中添加 (1) gsl? (2) gslcblas
?
注: 在GnuWin32的lib目錄下會有l(wèi)ibgsl.a 和libcblas.a 兩個靜態(tài)庫,mingw鏈接該靜態(tài)庫時,會自動去掉libgsl 與libgslcblas的lib.而mingw實際上的鏈接的庫文件名為-lgsl -lgslcblas. 如果在Dev-cpp下使用過gsl,Devcpp使用的編譯器其實也是mingw。google 牛人的bolg 上面都會提醒要在linker command line 上添加 -lgsl -lgslcblas。mingw在編譯時調(diào)用庫的函數(shù)為:mingw32/bin/ld.exe,給ld.exe 提供的命令行應(yīng)該就是庫的名字,該命令行要有如下格式: -lxxx,它在實際的靜態(tài)庫中對應(yīng)的庫文件為libxxx.a。而eclipse直接加上了-l 所以只需要提供xxx 作為庫文件名。
??????? 2.3.2 在library search path中添加 "D:/GnuWin32/lib" 也就是把libgsl.a 與libgslcblas.a的路徑告訴編譯器。
3 點擊apply 確定。使用如下測試代碼。
#include <iostream>
#include<gsl/gsl_matrix.h>
using namespace std;
?
int main() {
???? gsl_matrix *ma
????????? = gsl_matrix_alloc (2, 2);
???? cout << "!!!Hello World!!!" << endl; // prints !!!Hello World!!!
???? return 0;
}
1.新建C Project
2.HELLO WORLD ANSI C PROJECT Tool chains LINUX GCC
3.通過文件系統(tǒng)導(dǎo)入代碼
4.對著工程點property,C++ BUILD->SETTING->Tool Setting->include 設(shè)置/usr/include/gsl
5.GCC C Linker -l中 添加 gsl ?gslcblas m ?-L中填寫 /usr/lib
分享到:?總結(jié)
以上是生活随笔為你收集整理的gsl eclipse的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Latent semantic anal
- 下一篇: Entropy