svdComplexDEvice1.dll project with MinGW GCC toolchain in Eclipse IDE

Home and Applets > Download SVD-GPU Application Source Code > svdComplexDevice1.dll with MinGW GCC in Eclipse IDE

We may use MinGW GCC toolchain in Eclipse IDE for our C/C++ projects. As an example, we present a C mymath project that generates the shared library mymath.dll. The later is called by a C executable example project. These two projects are provided by Elias Volanakis
We also present the procedure for obtaining our 64-bit shared library svdComplexDevice1.dll with MinGW GCC toolchain in Eclipse IDE for Java developers.

*** Outline ***

  1. MinGW installation
  2. PATH variable editing for MinGW
  3. C shared library mymath project with MinGW GCC toolchain in Eclipse IDE
  4. C executable example project calling mymath.dll with MinGW GCC toolchain in Eclipse IDE
  5. C++ 64-bit shared library svdComplexDevice1.dll project with MinGW GCC toolchain in Eclipse IDE
  6. References

MinGW installation

Semicolon: How to fix MinGW file downloaded incorrectly error

  1. Download winlibs-x86_64-posix-seh-gcc-14.2.0-mingw-w64msvcrt-12.0.0-r2.zip: GCC 14.2.0 (with POSIX threads) + MinGW-w64 12.0.0 (MSVCRT) - release 2 without LLVM/Clang/LLD/LLDB for 64 bit Windows.

  2. Create an empty folder mingwu on C disk, for example C:\mingw
  3. Unzip mingw64 file into C:\mingw
  4. After installation, the folder contains:

PATH variable editing for MinGW

After installing MinGW, edit PATH variable of Windows 10.

  1. Right click PC computer then select Properties.

  2. System panel appears.
    Select Advanced system parameters.
    System properties panel appears.
    Click Environment Variables... button.
  3. Environment variables panel appears.
    Select Path in System variable box.

  4. Click Edit... button.
    Click Modify... button.
    Click New button.
    Add C:\mingw\mingw64\bin

    Click OK buttons.
  5. Test the installation:
    Enter cmd in Search of Windows.
    The command prompt of Windows appears.
    Enter g++ --version

C shared library mymath project with MinGW GCC toolchain in Eclipse IDE

  1. Launch Eclipse IDE for Java Developers.

    Select File, New, Project...
    New Project panel appears.
    Select C/C++ Project.
    Click New > button.
  2. New C/C++ Project panel appears.
    Select C Managed Build.

    Click Next > button.
  3. C Project panel appears.
    Provide Project name: mymath
    Select Shared Library then Empty Project.
    Select MinGW GCC in Toolchains.

    Click Finish button.
  4. The project folder mymath appears in Package Explorer of Eclipse.
  5. Click File menu. Select New, then File.
    Create New File panel appears.
    Provid File Name: mymath.h

    Click Finish button.
  6. An empty file mymath.h appears in mymath folder.
    Copy and past mymath.h file into the newly created header file.

  7. Similarly, create the folder mymath.c in Package Explorer of Eclipse.
  8. Copy and past mymath.c file into the newly created source file.

  9. To delete the first three letters lib in libmymath.dll, right click the project name in Package Explorer.
    Select Properties...
    Properties for mymath panel appears.
    Click C/C++ Build then Settings.
    Click Build Artifact tab.
    Select Shared Library for Artifact Type.
    Delete lib in Output prefix.

    Click Apply and Close button.
  10. Select Project menu then Build All.
    A folder, Debug, appears in Package Explorer. It contains the 64-bit DLL file mymath.dll

C executable example project calling mymath.dll with MinGW GCC toolchain in Eclipse IDE

We must specify three data during the setup of this project:
(1) the path of header file mymath.h to the compiler,
(2) the shared library mymath.dll and the path of its folder to the linker,
(3) the folder path of shared library mymath.dll to operating system Windows 11.

  1. Click File Menu of Eclipse. Select New, then Project...
    New project panel appears.
    Select C/C++ Project.
    Click Next > button.
    New C/C++ Project panel appears.
    Select C Managed Build.
    Click Next > button.
    C Project panel appears.
    Select Empty Project for Executable.
    Select MinGW GCC for Toolchains.
    Provide the project name: example

    Click Finish button.
  2. Right click example project in Package Explorer, then New, finally File.
    Create New File panel appears. Provide the File name: example.c
    Click Finish button.
  3. Copy example.c and paste it into the newly generated file.

    #include "mymath.h" is wavy underlined in red.

    We must provide the pathway of mymath.h to compiler. It is in the folder of C shared library mymath project.
  4. Right click the project name example in Package Explorer then select Properties.
    Properties for example panel appears.
    Click C/C++ General then Paths and Symbols.
    Click GNU C in Includes tab.
    Click Add... button.
    Add directory path panel appears.
    Provide the pathway:
    C:\Users\pm\eclipse-workspace\mymath

    Click OK button.

  5. Click Apply button.

  6. We must provide the filename mymath.dll required for this project and its folder location to linker. As a result, the later knows where the shared library is.
    Click C/C++ Build then Settings.
    Click Libraries for MinGW C Linker in Tool Settings tab.

    Click + symbol in top part of Libraries (-l).
  7. Enter Value panel appears.
    Provide mymath, the required DLL file without file extension.

    Click OK button.

  8. Click + symbol in top part of Library search path (-L).
  9. Add directory path panel appears.
    Provide the pathway of the project folder containing the required DLL file:
    C:\Users\pm\eclipse-workspace\mymath\Debug

    Click OK button.

  10. Click Apply button.

  11. Change user environment variable so that the operating system Windows 11 knows where the shared library mymath.dll is during the run time of example.exe.
    Click Environment of C/C++ Build.
    Select PATH.
    Click Edit... button.

  12. Edit variable panel appears.
    Insert the path: C:\Users\pm\eclipse-workspace\mymath\Debug;

    Click OK button.

  13. Click Apply and Close button.

  14. The project before Build.

    Press Ctrl S to save example.c.
  15. Select Project menu then Build Projet.

    64-bit example.exe file is generated in Debug folder.
  16. Select Run menu then Run.

    Select Local C/C++ Application then click OK button.
  17. Select Run menu then Run.

    The result appears on Console panel.

C++ 64-bit shared library svdComplexDevice1.dll project with MinGW toolchain in Eclipse IDE

  1. Launch Eclipse IDE for Java Developers.
    Press CTRL N.
    Select a wizard panel appears.
    Select C/C++ folder then C/C++ Project.
    Click Next > button.
    New C/C++ Project panel appears.
    Select C++ Managed Build.
    Click Next > button.
    C++ Project panel appears.
    Provide the project name: svdComplexDevice1
    Select Empty Project for Shared Library.
    Select MinGW GCC for Toolchains.

    Click Finish button.
  2. The project folder svdComplexDevice1 appears in Package Explorer of Eclipse.
  3. Right click the project folder svdComplexDevice1.
    Select New, then File.
    Create New File panel appears.
    Provide the File name: svdComplexDevice1.h

    Click Finish button.
  4. Copy and past svdComplexDevice1.h file into the newly created header file.

    Press Ctrl S to save svdComplexDevice1.h.
  5. Similarly, create the empty file svdComplexDevice1.cpp
  6. Copy and past svdComplexDevice1.cpp file into the newly created file.

    Press Ctrl S to save svdComplexDevice1.cpp.
  7. Provide the path of include folder of CUDA and that of CULA to compiler. Include folder contains header files.
    Right click svdComplexDevice1 project in Package Explorer then select Properties.
    Properties for svdComplexDevice1 panel appears.
    Click Settings in C/C++ Build.
    Click Includes for GCC C++ Compiler in Tool Settings tab.

    Click + symbol in top part of Include paths (-I).
  8. Add directoriy path panel appears.
    Provide "${CUDA_INC_PATH}" for Directory.
    Directory must be enclosed in double quotes because this path contains space characters.

    Click OK button.
  9. Similarly, provide the second path: "${CULA_INC_PATH}"

    Click Apply button.
  10. A message apears.

    Click Rebuild Index button.

  11. Provide four libraries (cula_core.lib, cublas.lib, cudart.lib, and cula_lapack.lib) and their folder location ("${CUDA_LIB_PATH_64}" and "${CULA_LIB_PATH_64}") to the linker.
    Click Libraries for MinGW C++ Linker in Tool Settings tab.

  12. The result is:

    Library file names are provided without extension .lib and paths are enclosed in double quotes.
    Click Apply button.
  13. Click Build Artifact tab.

    Delete lib in Output prefix.
    Click Apply and Close button.
  14. The project before Build.

  15. Select Project menu then Build Projet.

    64-bit svdComplexDevice1.dll file with 246 kbit size is generated in Debug folder.
    A message appears on CDT Build Console.

References

  1. Eclipse Foundation: Setting up MinGW-w64
    It is essential that the installation path does not contain any spaces. Therefore, you cannot install MinGW-w64 in Program Files. We recommend to create a folder mingw-w64 on your system drive (e.g., C:\mingw).
  2. Transmissin Zero: Build Windows DLLs with MinGW
  3. Cygwin: Building and using DLLs
  4. cplusplus: How to create and use DLL's
  5. Stratman, Forex Factory: C++ dll tutorials using Eclipse
  6. Capsis: A complete Java - C++ connection example with mingw/g++ and JNA under Windows 64 bits
  7. Elias Volanakis, Eclipse Source: Shared libraries with Eclipse CDT and cygwin on Windows
    The compiler and linker will not find the header files / library unless you set the appropriate parameters. The compiler needs an include path (-I). The linker needs the library name (-l) and library search path (-L). These settings are scattered in two places in the project properties. Their location is not obvious for a first-time user.
  8. Erich Styger, MCU on Eclipse: Eclipse build variables
  9. Erich Styger, MCU on Eclipse: Debug vs. release?
  10. OpenCV: Using OpenCV with Eclipse (plugin CDT)
  11. Syntax Scenarios: Install MinGW on Windows to run a C program
  12. Grenoble-inp: Compilation séparée et options de gcc
  13. Grenoble-inp: Programmation C et C++ - Utiliser le compilateur GCC

Solid-state NMR bibliography for:

Aluminum-27
Antimony-121/123
Arsenic-75
Barium-135/137
Beryllium-9
Bismuth-209
Boron-11
Bromine-79/81
Calcium-43
Cesium-133
Chlorine-35/37
Chromium-53
Cobalt-59
Copper-63/65
Deuterium-2
Gallium-69/71
Germanium-73
Gold-197
Hafnium-177/179
Indium-113/115
Iodine-127
Iridium-191/193
Krypton-83
Lanthanum-139
Lithium-7
Magnesium-25
Manganese-55
Mercury-201
Molybdenum-95/97
Neon-21
Nickel-61
Niobium-93
Nitrogen-14
Osmium-189
Oxygen-17
Palladium-105
Potassium-39/41
Rhenium-185/187
Rubidium-85/87
Ruthenium-99/101
Scandium-45
Sodium-23
Strontium-87
Sulfur-33
Tantalum-181
Titanium-47/49
Vanadium-51
Xenon-131
Zinc-67
Zirconium-91
[Contact me] - Last updated November 18, 2024
Copyright © 2002-2024 pascal-man.com. All rights reserved.