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.

MinGW installation

Semicolon: How to fix MinGW file downloaded incorrectly error

  1. Download MinGW-W64 online installer (MinGW-W64-install.exe) for 32 and 64 bit Windows.
  2. Create an empty folder mingwu on C disk, for example C:\mingw
  3. Click MinGW-W64-install.exe.
    Welcome panel appears.

    Click Next > button.
  4. Settings panel appears.
    Select x86_64 for Architecture.

    Click Next > button.
  5. Installation folder panel appears.
    Select C:\mingw.

    Click Next > button.
  6. 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 button.
  5. Test your 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 C/C++ Developers.

    Select Create a new C or C++ project.
  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.

    Only two toolchains are available.
    Click Finish button.
  4. The project folder mymath appears in Project Explorer of Eclipse.

  5. Click File menu. Select New, then Header File.
    Provide the name for Hearder file: mymath.h

    Click Finish button.
  6. Copy and past mymath.h file into the newly created header file.

  7. Click File menu. Select New, then Source File.
    Provide the name for Source file: mymath.c

    Click Finish button.
  8. Copy and past mymath.c file into the newly created source file.

  9. Select Project menu then Build All.
    Two folders, Binaries and Debug, appear in Project Explorer. They contains the 64-bit DLL file libmymath.dll

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

    Click Apply and Close button.
  11. Select Project menu then Build All.

    A new 64-bit DLL file, mymath.dll, is generated in Binaries and Debug folders.
  12. To delete libmymath.dll, right click it in Project Explorer then select Delete.

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 10.

  1. Click File Menu of Eclipse. Select New, then C/C++ Project.
    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

    Only two toolchains are available.
    Click Finish button.
  2. Right click example project in Explorer Project, then New, finally Source File.
    New Source file panel appears. Provide the name for Source file: 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.

    You 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 Explorer Project 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\Papa\eclipse-workspace\mymath

    Click OK button.

  5. Click Apply button.

  6. You 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\Papa\eclipse-workspace\mymath\Debug

    Click OK button.

  10. Click Apply button.

  11. Change user environment variable so that the operating system Windows 10 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.

  13. Insert the path: C:\Users\Papa\eclipse-workspace\mymath\Debug;

    Click OK button.

  14. Click Apply and Close button.

  15. The project before Build.

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

    64-bit example.exe file is generated in Binaries and Debug folders.
  17. Select Run menu then Run.

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

    The result appears on Console panel.
  19. Select Run menu then Run Configurations...
    Click C/C++ Application.

    Click Close button.

User environment variables in Windows 10

To reduce the numbers of messages during the setup of any 64-bit project, we have already included the six paths into user environment variables (INCLUDE, Path, and LIB) of Windows 10:

  1. C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include
    for cancelling wavy underlines (iostream)
    C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\ucrt
    for corecrt.h
  2. C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64
    for compiler cl.exe
  3. C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\lib\amd64
    for msvcprt.lib
    C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17763.0\um\x64
    for kernel32.lib
    C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17763.0\ucrt\x64
    for ucrt.lib

Windows 10 user and system environment variables:


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

  1. Launch Eclipse IDE for C/C++ Developers.

    Select Create a new C or C++ project.
  2. New C/C++ Project panel appears.
    Select C++ Managed Build.

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

    Only two toolchains are available.
    Click Finish button.
  4. The project folder svdComplexDevice1 appears in Project Explorer of Eclipse. it contains Includes folder.

  5. Click File menu. Select New, then Header File.
    Provide the name for Header file: svdComplexDevice1.h

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

    Press Ctrl S to save svdComplexDevice1.h.
  7. Click File menu. Select New, then Source File.
    Provide the name for Source file: svdComplexDevice1.cpp

    Click Finish button.
  8. Copy and past svdComplexDevice1.cpp file into the newly created source file.

    Press Ctrl S to save svdComplexDevice1.cpp.
  9. With build variables you avoid using absolute paths.
    Right click svdComplexDevice1 project in Explorer Project then select Properties.
    Properties for svdComplexDevice1 panel appears.
    Click C/C++ Build then Build Variables.

    Click Add... button.
  10. Define a New Build Variable panel appears.
    Provide Variable name: CUDA_INC_PATH
    Select Path for Type.
    Provide Value: C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\include

    Click OK button.
  11. Properties for svdComplexDevice1 appears.

  12. Similarly, provide three more build variables:
    CUDA_LIB_PATH_64 and C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\lib\x64
    CULA_INC_PATH and C:\Program Files\CULA\R15\include
    CULA_LIB_PATH_64 and C:\Program Files\CULA\R15\lib64
    CULA_INC_PATH and CULA_LIB_PATH_64 are already defined in Windows 10 system variables. As a result, their path are filled automatically.

    Click Apply button.

  13. Provide the path of include folder of CUDA and that of CULA to compiler. Include folder contains header files.
    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).
  14. 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.
  15. Similarly, provide the second path.
    "${CULA_INC_PATH}"

    Click Apply button.
  16. A message apears.

    Click Yes button.

  17. 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.

  18. The result is:

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

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

  21. Select Project menu then Build Projet.

    64-bit svdComplexDevice1.dll file is generated in Binaries and Debug folders.
    A message appears on CDT Build Console.
  22. Identical result can be obtained as shown below

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. MinGW: HOWTO create and deploy a sample DLL using MinGW
  7. MinGW: Specify the libraries for the linker to use
  8. Capsis: A complete Java - C++ connection example with mingw/g++ and JNA under Windows 64 bits
  9. 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.
  10. Erich Styger, MCU on Eclipse: Eclipse build variables
  11. Erich Styger, MCU on Eclipse: Debug vs. release?
  12. OpenCV: Using OpenCV with Eclipse (plugin CDT)
  13. Eclipse: CDT/User/FAQ

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 September 01, 2022
Copyright © 2002-2024 pascal-man.com. All rights reserved.