preamble
This paper provides a methodology for integrating theEasyX Adapts libraries to MinGW and details how to configure EasyX to IDEs that use MinGW as a compiler, such as DevCpp or CodeBlocks.
Library File Download
Click here to download easyx4mingw_20220901
Click here to download easyx4mingw_20220610 (previous version)
be in favor ofMinGW releases
Support for TDM-GCC 4.8.1 and above (both 32-bit and 64-bit). i.e., all versions of TDM-GCC released on or after September 28, 2013 are supported.
IDEs using TDM-GCC version 4.8.1 and above are supported. Example:
- Code::Blocks 13.12 and above
- DevCpp 5.8.0 and above
Also additional support:
- DevCpp 5.4.0 GCC MinGW 4.7.2 (C/C++ Programming Environment for the 13th Blue Bridge Cup Competition Student Machine)
- C-Free 5.0 (built-in GCC MinGW 3.4.5)
MinGW-w64 There are many versions with limited support. For example, for MinGW-w64 version 8.1.0, easyx4mingw supports x86_64-posix-seh, x86_64-win32-seh, i686-posix-sjlj, i686-win32-sjlj, but not x86_64-posix-sjlj, x86_64- win32-sjlj, i686-posix-dwarf, i686-win32-dwarf.
Note: There are many versions of MinGW, and TDM-GCC is recommended. (To understand the difference, refer to the[here])
List of documents
The files in the downloaded zip are listed below:
easyx4mingw_20220606.zip
├ include <folder>
│ ├óΓé¼┼ôHeader files (which provide the most current version of the interface)
│ └ // Header files (based on, but retaining, several old interfaces)
├ lib32 <folder>
│ └ // 32-bit library files for TDM-GCC version 4.8.1 and above
├ lib64 <folder>
│ └ // 64-bit libraries for TDM-GCC version 4.8.1 and above
└ lib-for-devcpp_5.4.0
└ // For DevCpp 5.4.0 GCC MinGW 4.7.2 and C-Free 5.0.
Configuration
Basically, configuring easyx for mingw for any development environment is a two-step process:
1. Installation of library files
Unzip the downloaded package, then copy the header files under include and the library files under lib32/lib64 to the MinGW header files and library files respectively. If you are not sure about the path of the library files, please refer to the QA section at the end of this article.
2. Add compile-time linking options
Add the linking option: -leasyx so that you can link the library files at compile time. This should be set once per project, then just compile.
Note: For version 20220610, you need to add -leasyx -lgdi32 -lole32 to the link options.
Configuration Details
Detailed instructions for configuring EasyX with CLion
1. Install MinGW
CLion does not come with a compiler by default, you need to install it manually. Note that there are many versions of MinGW, currently EasyX supports the TDM-GCC version of MinGW. download page: /tdm-gcc/download/, the following is an example of version 9.2.0.
Official Website Download tdm64-gcc-9.2. maybeMirror site to download tdm64-gcc-9.2. Both (57.6M).
show (a ticket)tdm64-gcc-9.2. Perform a MinGW installation:
- Uncheck“Check for updated files on the TDM-GCC server”,Then tap Create buttons。
- Set the path (the following is an example of the path D:\App\TDM-GCC-64).
- Select components. You can check all of them. If you are a system cleaner, you can uncheck "Start Menu items" and "Add to PATH".
- Tap the Install button and the installation will be completed later. It takes about 490MB of disk space and 4894 files.
2. Configuring the CLion to use TDM-GCC
Open CLion (as an example for the English version 2021.2.3)
Menu File -> Settings... In the left side, select Build, Execution, Deployment / Toolchains settings, on the right side, click "+", select MinGW, and in the Environment item, select D:\App\TDM-GCC-64, and then all the projects below will be configured automatically. Configured.
If there are multiple configurations under the "+", select MinGW and drag it to the top to make it the default. Tap OK to save the settings.
3. Configuring EasyX to TDM-GCC
downloadingeasyx4mingw_20220901.zip, unpacking.
Copy and from the include folder to the D:\App\TDM-GCC-64\x86_64-w64-mingw32\include\ folder.
Copy lib64\ into D:\App\TDM-GCC-64\x86_64-w64-mingw32\lib\ folder.
Copy lib32\ to the folder D:\App\TDM-GCC-64\x86_64-w64-mingw32\lib32\.
Installation complete.
4. Writing EasyX programs
Open CLion, menu File -> New Project, select C++ Executable, fill in the project path in Location, tap Create button to create the project, and then enter the following code:
-
#include <>
-
#include <>
-
-
int main()
-
{
-
initgraph(640, 480);
-
circle(320, 240, 100);
-
_getch();
-
return 0;
-
}
You need to edit the library file that introduces EasyX. In front of the line add_executable(...), add the directive to introduce the library file. line, add the directive to introduce the library file:
link_libraries()
Compile and execute to see a circle drawn.
Code::Blocks Configuration Details for EasyX
The following configuration instructions are only based on the original official Code::Blocks 20.03 (64-bit) download:Code::Blocks (integrated with mingw) 20.03 - AppZipIf the installation path of Code::Blocks is D:\App\, it is assumed that the installation path of Code::Blocks is D:\App\.CodeBlocks。
1. Installation of library files
downloadingeasyx4mingw_20220901.zip, unpacking.
Copy and from the include folder to the D:\App\CodeBlocks\MinGW\x86_64-w64-mingw32\include\ folder.
Copy lib64\ into D:\App\CodeBlocks\MinGW\x86_64-w64-mingw32\lib\ folder. Since Code::Blocks 20.03 only contains 64-bit mingw, you only need to copy this one library file.
Special note: Because Code::Blocks 20.03 comes with 64-bit MinGW, it is copied from lib64. If you are using Code::Blocks 17.12, which comes with 32-bit MinGW, copy it from lib32. The QA section at the end lists the versions of MinGW that come with common compilers.
2. Add compile-time linking options
(1) Create a new project: Menu File -> New -> Project... SelectConsole application, tap Go to enter the project wizard. Choose C++ as the language, Test as the project name, D:\MyDocs\(or fill in according to your own situation) as the path, choose GNU GCC Compiler as the compiler, and basically don't move the other options, finish.
(2) Write basic test code as follows:
-
#include <>
-
#include <>
-
-
int main()
-
{
-
initgraph(640, 480);
-
circle(320, 240, 100);
-
getch();
-
closegraph();
-
return 0;
-
}
(3) Linker settings: Menu Project -> Build options..., select the project name Test. Select the project name Test on the left side, select the tab Linker settings on the right side, and enter -leasyx in the text box under Other linker options, then finish.
(4) Tap the toolbar button Build and run or press F9 to compile and execute the program, you can see a circle drawn on the screen. If there is a compilation error, please correct the program according to the error message.
3. Generate project templates to simplify operations
With the previous two steps, you can already use EasyX. However, it's a bit of a pain to set up the link library every time you write a new project. You can simplify this process by generating a project template:
Menu File -> Save project as template... Fill in the template name: EasyX Application, done.
The next time you create a project, you can select EasyX Application under User templates, then select the path and project name, and start writing the EasyX drawing program directly without setting up the link library.
Detailed instructions for configuring EasyX with Dev-C++
The following configuration instructions are based only on the official original Dev-C++ 6.3 released by Embarcadero, available for download:Dev-C++ 6.3 - AppZipIf the installation path of Dev-Cpp is D:\App\DevCpp, the installation path of Dev-Cpp is assumed to be D:\App\DevCpp.
1. Installation of library files
downloadingeasyx4mingw_20220901.zip, unpacking.
Copy and into the D:\App\DevCpp\TDM-GCC-64\x86_64-w64-mingw32\include\ folder.
Copy lib64\ into D:\App\DevCpp\TDM-GCC-64\x86_64-w64-mingw32\lib\ folder.
Copy lib32\ into D:\App\DevCpp\TDM-GCC-64\x86_64-w64-mingw32\lib32\ folder.
2. Add compile-time linking options
(1) Create a new project: Menu File -> New -> Project... Choose Console application, project name Test, choose C++, click OK, then save it to D:\MyDocs\Test\ (or fill in according to your own situation), finish.
(2) Write basic test code as follows:
-
#include <>
-
#include <>
-
-
int main()
-
{
-
initgraph(640, 480);
-
circle(320, 240, 100);
-
getch();
-
closegraph();
-
return 0;
-
}
(3) Set the link library: menu Project -> Project Options..., select tab Parameters, then enter -leasyx in Linker, finish. Choose the tab Parameters, then enter -leasyx in Linker, finish.
(4) Tap the toolbar button Compile & run or press F11 to compile and execute, you can see a circle drawn on the screen. If there is a compilation error, please correct the program according to the error message.
3. Generate project templates to simplify operations
With the previous two steps, you can already use EasyX. However, it's a bit of a pain to set up the link library every time you write a new project. You can simplify this process by generating a project template:
Menu File -> New -> Project Template... Fill in the template name: EasyX Application, other options can be filled in according to your own preferences, finish.
The next time you create a project, you can directly select EasyX Application, then fill in the project name, select the path, and start writing the EasyX drawing program directly without having to set up the link library.
common problems
Q: I have a bad configuration, how can I determine if it's a problem with my local machine or the library? Is there a packaged one for me to test?
A: Packaged DevC++5.11 green version of EasyX:Baidu.com Please enter the extraction code(Extract code: 8frc). Usage:
- Extract it to D:\App\DevCpp.
- Run (Chinese environment has been set up).
- Create a new project and select EasyX Application under Multimedia.
- Paste the previously mentioned test code, compile and run it.
If you can see a circle drawn, the library is fine. At this point, you can choose to use this version of DevC++, or you can try to troubleshoot your previous configuration steps again.
Q: There are so many folders, where exactly should I copy the library files to?
A: Different IDEs integrate different versions of MinGW and configure different paths. The following table lists the default header and library file paths for common IDEs:
integrated development environment (IDE) | Header file path | 32-bit library file path | 64-bit Library File Path |
Code::Blocks 20.03 | Installation path\MinGW\x86_64-w64-mingw32\include | (none) | Installation path\MinGW\x86_64-w64-mingw32\lib |
Code::Blocks 17.12 | Installation path\MinGW\include | Installation path\MinGW\lib | (none) |
Code::Blocks 16.01 | Installation path\MinGW\include | Installation path\MinGW\lib | (none) |
Code::Blocks 13.12 | Installation path\MinGW\include | Installation path\MinGW\lib | (none) |
Dev-C++ 6.3 | Installation path\TDM-GCC-64\x86_64-w64-mingw32\include | Installation path\TDM-GCC-64\x86_64-w64-mingw32\lib32 | Installation path\TDM-GCC-64\x86_64-w64-mingw32\lib |
Dev-C++ 5.11 | Installation path\MinGW64\x86_64-w64-mingw32\include | Installation path\MinGW64\x86_64-w64-mingw32\lib32 | Installation path\MinGW64\x86_64-w64-mingw32\lib |
Dev-C++ 5.8.0 | Installation path\MinGW64\x86_64-w64-mingw32\include | Installation path\MinGW64\x86_64-w64-mingw32\lib32 | Installation path\MinGW64\x86_64-w64-mingw32\lib |
Dev-C++ 5.4.0 (Blue Bridge Cup Edition*) | Installation path\MinGW32\include | Installation path\MinGW32\lib (requires lib-for-devcpp_5.4.0\) |
(none) |
C-Free 5.0 | Installation path\mingw\include | Installation path\mingw\lib (requires lib-for-devcpp_5.4.0\) |
(none) |
Note: Blue Bridge Cup version refers to Dev-C++ 5.4.0 provided by the official website of Blue Bridge Cup. The official Dev-C++ 5.4.0 is divided into two versions, and the Blue Bridge Cup uses the 32-bit mingw version.
Q:Error when creating project template: Unable to write to C:\Program Files (x86)\Embarcadero\Dev-Cpp\Templates\EasyX .
A: If you install Dev-C++ under C:\Program Files, then the file modification requires administrator privileges. So, start Dev-C++ with administrator privileges and repeat the steps of creating a project template. After successfully creating the project template, you don't need administrator privileges to start it for normal use.
Q:I have installed other versions of Dev-C++ before, and this time I followed the tutorial strictly, but I still have problems.
A: Some legacy configuration files of the old version of Dev-C++ may affect the new version, the path of the configuration file is: C:\Users\[username]\AppData\Roaming\Dev-Cpp, just delete the whole folder. If you can't find it, just type %APPDATA%\Dev-Cpp in the address bar of the file manager and hit enter, then you can automatically jump to the folder and delete it.
Q:After pasting some sample code, it prompts that the _getch function cannot be used.
A: Use getch instead.
Q: Does it matter if I have more than one compiler installed on my system?
A: Most likely it will. Please check the compiler settings:
- For Code::Blocks, menu Settings / Compiler..., under Global compiler settings, Selected compiler, select GNU GCC Compiler. For Code::Blocks, menu Settings / Compiler..., under Global compiler settings, Selected compiler, select GNU GCC Compiler, and under the Toolchain executables tab below, check that the Compiler's installation directory is MinGW under the Code::Blocks folder. Blocks folder, if your Code::Blocks installation path is D:\App\CodeBlocks, then the compiler path should be D:\App\CodeBlocks\MinGW.
- For Dev C++ 6.3, menu Tools/Compiler Options... , below the Directories tab, check that Binaries, Libraries, C Includes, C++ Includes, are not under the Dev C++ installation path.
Q: How can I not configure it well, I can't find where the problem is, how can I fix it?
A: Focus on checking the "compilation log". Take the official Dev-Cpp 6.3 as an example, after configuration, click "Recompile All" (or press F12), and then look at the compilation log:
Taking the Dev-Cpp 6.3 environment in the example, the compilation parameters are:
-
g++.exe -c -o -I"D:/App/Dev-Cpp/TDM-GCC-64/include" -I"D:/App/Dev-Cpp/TDM-GCC-64/x86_64-w64-mingw32/include" -I"D:/App/Dev-Cpp/TDM-GCC-64/lib/gcc/x86_64-w64-mingw32/9.2.0/include" -I"D:/App/Dev-Cpp/TDM-GCC-64/lib/gcc/x86_64-w64-mingw32/9.2.0/include/c++"
-
g++.exe -o -L"D:/App/Dev-Cpp/TDM-GCC-64/lib" -L"D:/App/Dev-Cpp/TDM-GCC-64/x86_64-w64-mingw32/lib" -static-libgcc -lEasyX -lgdi32 -lole32
Problems can be found by checking against the compilation parameters.
END
Today's sharing ends here, if you encounter problems on the way of programming learning, why not come to my programming learning exchange base to learn and discuss together!
C/C++ Programming Learning Base/? _wv=1027&k=CDsA9bcr