回 帖 发 新 帖 刷新版面

主题:有没有用CODE BLOCKS作IDE的,你们用的是什么线性代数库?

这个问题我都快疯了,就是不知道怎么设置,从IMSL到MKL,又到LAPACK,折腾一个星期了,还是没设置好。有没有哪些朋友也遇到过这些问题,求指点迷津。

回复列表 (共53个回复)

沙发

好熟悉的ID,我在CSDN上给你回了吧,还没解决么?

CB里可以在Project-Build Options-Linker settings
在link libraries(如果你在搜索路径里设置了)或是Other linker options(自定义添加链接开关)添加相应的库即可

板凳


太感动了,你的热情让我觉的很惭愧,因为一直都没弄好。还是LAPACK的编译问题,总是编不成功,我把自己的步骤仔细说一下吧,看看哪里出问题了(系统VISTA,IDE:CB,complier:g95):
1:运行G:\Program Files\CMake 2.8\bin文件下的CMake-gui。
2:"where is the source code"选择为G:/lapack-3.3.0;"where to build the binaries"任选一非中文目录
3:点击下面的"configure"按钮,出来一对话框:
Specify the generator to this project:
关于CB的供选择项有三个,分别是CB-MinGw Makefiles、CB-Nmake Makefiles、CB-Unix Makefiles(我选择的是CB-MinGw MakeFiles)。
接下来又有四个单选框:Use default native complier(默认选项)、Specify native complier、Specify toolchain for cross-compling、Specify options for cross-compling。这四不知道该选择哪个,每个我都试了下:

1:若选择“Use default native complier”,最后出错:
The Fortran compiler identification is GNU
CMake Error: your RC compiler: "CMAKE_RC_COMPILER-NOTFOUND" was not found.   Please set CMAKE_RC_COMPILER to a valid compiler path or name.
Check for working Fortran compiler: G:/Rtools/MinGW/bin/gfortran.exe
CMake Error at G:/Program Files/CMake 2.8/share/cmake-2.8/Modules/CMakeRCInformation.cmake:22 (GET_FILENAME_COMPONENT):
  get_filename_component called with incorrect number of arguments
Call Stack (most recent call first):
  G:/Program Files/CMake 2.8/share/cmake-2.8/Modules/Platform/Windows-GNU.cmake:59 (enable_language)
  G:/Program Files/CMake 2.8/share/cmake-2.8/Modules/Platform/Windows-GNU-Fortran.cmake:1 (include)
  G:/Program Files/CMake 2.8/share/cmake-2.8/Modules/CMakeFortranInformation.cmake:33 (INCLUDE)
  CMakeLists.txt:2 (PROJECT)


CMake Error: CMAKE_RC_COMPILER not set, after EnableLanguage
CMake Error: Internal CMake error, TryCompile configure of cmake failed
Check for working Fortran compiler: G:/Rtools/MinGW/bin/gfortran.exe  -- broken
CMake Error at G:/Program Files/CMake 2.8/share/cmake-2.8/Modules/CMakeTestFortranCompiler.cmake:40 (MESSAGE):
  The Fortran compiler "G:/Rtools/MinGW/bin/gfortran.exe" is not able to
  compile a simple test program.

  It fails with the following output:

   

  

  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:2 (project)

2:若选择“Specify native complier”,结果为:
The Fortran compiler identification is G95
CMake Error at G:/Program Files/CMake 2.8/share/cmake-2.8/Modules/CMakeDetermineRCCompiler.cmake:30 (MESSAGE):
  Could not find compiler set in environment variable RC:

  CMAKE_RC_COMPILER-NOTFOUND.
Call Stack (most recent call first):
  G:/Program Files/CMake 2.8/share/cmake-2.8/Modules/Platform/Windows-GNU.cmake:59 (enable_language)
  G:/Program Files/CMake 2.8/share/cmake-2.8/Modules/Platform/Windows-GNU-Fortran.cmake:1 (include)
  G:/Program Files/CMake 2.8/share/cmake-2.8/Modules/Platform/Windows-G95-Fortran.cmake:1 (include)
  G:/Program Files/CMake 2.8/share/cmake-2.8/Modules/CMakeFortranInformation.cmake:33 (INCLUDE)
  CMakeLists.txt:2 (project)


CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
Missing variable is:
CMAKE_RC_COMPILER_ENV_VAR
CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
Missing variable is:
CMAKE_RC_COMPILER
CMake Error: Could not find cmake module file:C:/Users/lolo/Desktop/CMakeFiles/CMakeRCCompiler.cmake
CMake Error: CMAKE_RC_COMPILER not set, after EnableLanguage
Configuring incomplete, errors occurred!



3:若选择“Specify toolchain for cross-compling”,结果为:
CMake Error: Error in cmake code at
G:/g95/bin/g95.exe:1:
Parse error.  Expected a command name, got unquoted argument with text "MZ".
CMake Error at G:/Program Files/CMake 2.8/share/cmake-2.8/Modules/CMakeDetermineSystem.cmake:92 (MESSAGE):
  Could not find toolchain file: G:/g95/bin/g95.exe
Call Stack (most recent call first):
  CMakeLists.txt:2 (project)


CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
Missing variable is:
CMAKE_Fortran_COMPILER_ENV_VAR
CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
Missing variable is:
CMAKE_Fortran_COMPILER
CMake Error: Could not find cmake module file:C:/Users/lolo/Desktop/CMakeFiles/CMakeFortranCompiler.cmake
CMake Error: CMAKE_Fortran_COMPILER not set, after EnableLanguage
Configuring incomplete, errors occurred!

3 楼

Use default native complier
是指选择默认编译器,mingw gcc默认gfortran

Specify toolchain for cross-compling
是指选择交叉编译工具链,比如你在linux下生成windows的程序,你的环境也不符合

所以你只能选择Specify native complier
请注意,你选择mingw时,要确认你的mingw是否已经安装了,mingw/bin目录是否已经在windows系统path中了,他的make是否是mingw32-make。

我感觉用g95的话,还得设置默认库的路径(LD_LIBRARY_PATH),我没用过,不清楚这个。

还是推荐使用gfortran(注意,不要和g95同时用,使用gfortran前,要把g95完全卸载,环境变量里要把g95的东西完全清除,否则会出现链接错误)

4 楼


mingw是个什么东西,我以为编译器里已有带着了,我的系统变量中有一个名为“G95_LIBRARY_PATH”的变量,变量值是“G:\g95\lib;G:\g95\lib\gcc-lib\i686-pc-mingw32\4.1.2”,是不是表示已经安装mingw了?

5 楼


Specify the generator to this project应该选哪个,关于CB的供选择项有三个,分别是CB-MinGw Makefiles、CB-Nmake Makefiles、CB-Unix Makefiles。

6 楼

[quote]
mingw是个什么东西,我以为编译器里已有带着了,我的系统变量中有一个名为“G95_LIBRARY_PATH”的变量,变量值是“G:\g95\lib;G:\g95\lib\gcc-lib\i686-pc-mingw32\4.1.2”,是不是表示已经安装mingw了?[/quote]
原来g95是依托mingw的……

那你看看g95/bin下有无mingw32-make
同时把g95/bin加入系统PATH路径

7 楼


g95/bin下没有mingw32-make,
g95/bin下的文件分别是ar.exe,as.exe,g95.exe,ld.exe,mingwm10.dll,ranlib.exe,strip.exe。

还需要把把g95/bin加入系统PATH路径么?

8 楼

从这里下载mingw32-make
http://sourceforge.net/projects/mingw/files/MinGW/make/make-3.82-mingw32/make-3.82-5-mingw32-bin.tar.lzma/download
mingw32-make.exe放入g95/bin目录,bin目录同时加入path,否则你没法make

9 楼

[quote]从这里下载mingw32-make
http://sourceforge.net/projects/mingw/files/MinGW/make/make-3.82-mingw32/make-3.82-5-mingw32-bin.tar.lzma/download
mingw32-make.exe放入g95/bin目录,bin目录同时加入path,否则你没法make[/quote]


从你给的地址“http://sourceforge.net/projects/mingw/files/MinGW/make/make-3.82-mingw32/make-3.82-5-mingw32-bin.tar.lzma/download”下载的是一个名为“make-3.82-5-mingw32-bin.tar.lzma”的文件,并不是 .exe执行文件啊,是要把make-3.82-5-mingw32-bin.tar.lzma放入g95/bin目录?

10 楼

那个是压缩文件,你需要7zip进行解压

我来回复

您尚未登录,请登录后再回复。点此登录或注册