Adding GSL Library on Eclipse with the help from MinGW

  1. Download MinGW installer from the official website
  2. Install MinGW with the latest version
  3. Follow the instruction on the guide Getting Started so as to download and set up the gcc and g++ compiler
  4. Download and unzip GSL library source from the offical website
  5. Copy the GSL source folder to the MinGW installation path, for example, C:\MinGW\msys\1.0\home, which is equivalent to /home in the GNU system
  6. Read the INSTALL in GSL source folder. If you want to have a quick set up, read the instruction under "The simplest way to compile this package is"
  7. Write the code which invokes function in GSL by following the example of GSL in the offical web site

  8. Download Eclipse IDE for C/C++ Developers (includes Incubating components) from the offical website.
  9. Unzip and open the eclipse.exe inside.
  10. Follow the instruction to do the initial set up for the IDE.
  11. After that, start a new project and choose MinGW as the toolchain for the project. Then click finish.
  12. Right click your project in the Project Explorer then click Properties.
  13. We need to construct the commands as shown in the GSL example with the steps. below.
  14. Under C/C++ Build –> Settings –> GCC C++ Compiler –> Includes, add the following paths: (supposing your MinGW installation path is C:\MinGW)
  15. Repeat the previous step under C/C++ Build –> Settings –> GCC C Compiler –> Includes
  16. In MinGW C++ Linker –> Libraries –> Libraries (-l), add the followings:
  17. In MinGW C++ Linker –> Libraries –> Library search path (-L), add the foolowing paths:
  18. Create a new C++ file and copy the example of GSL to the editor.
  19. Click Run Configuration, add a new configuration under C/C++ Application and press OK
  20. Rebuild the whole project to see the results


    發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *