The author’s related study collection articles are welcome to come to learn and exchange:
Closer to home, the content of this issue: How to configure the easyx graphics library in Dev-Cpp? That’s enough, it’s super detailed!
Directory:
1. Download the compiler version of easyx MinGW!
2. How to configure the easyx graphics library in Dev-Cpp!
- - 2.1 Find the Dev-Cpp installation path
- - 2.2 easyx header file configuration
- - 2.3 easyx library configuration
3. Verify the configuration in Dev-Cpp and encapsulate the easyx project template
- - 3.1 Create a new project test configuration
- - 3.2 Encapsulate the easyx project template: Once and for all
4. Check the result of configuring easyx template in Dev-Cpp
1. Download the compiler version of easyx MinGW!
Download guide: Enter the official website => Click on the upper right corner to download => Find the appropriate version and
click on the [more] official website link to go directly [Official website interface is as follows]
Enter the official website => click on the upper right corner to download
Note: If the easyx graphics library is configured with "vs", you can download it directly from the place marked with "×" in the picture ! But if you configure the easyx graphics library in "Dev-Cpp", you must search for the "MinGW compiler version" to download !
Find the appropriate version and click [more]
Find "MinGW compiler version" and download it!
2. How to configure the easyx graphics library in Dev-Cpp!
General overview:
- "Install library files" : Copy the header files under include and the library files under lib32/lib64 of the downloaded easyx library to the header files and library files of MinGW respectively.
- "Add link options during compilation" : Add link options: -leasyx, so that the libeasyx.a library file can be linked during compilation. Each project needs to be set up like this once and then compiled. [Note: For version 20220610, you need to add -leasyx -lgdi32 -lole32 to the link option. 】
Specific steps are as follows:
2.1 Find the Dev-Cpp installation path
Step one: Find your DevCpp installation path!
2.2 easyx header file configuration
Step 2: Copy easyx.h and graphics.h under the include folder in the decompressed easyx compressed package to: The
version shown below is the road configuration reference.
The author (devc++511 as an example!)
2.3 easyx library configuration
Step 3: Copy lib64\libeasyx.a in the decompressed easyx compressed package to the
version shown below for reference.
The author (devc++511 as an example!)
3. Verify the configuration and encapsulate the easyx project template in Dev-Cpp
3.1 New project test configuration
Step 1: Create a new empty project: Click File–>New–>Project. Create empty project!
Step 2: Set up the link library: Click Project –> Project Properties, select parameters, and then enter -leasyx in the link to complete.
Note: If you download version 20220610: you need to add -leasyx -lgdi32 -lole32 to the link option.
Compile and test the following code!
#include<stdio.h>
#include<easyx.h>
int main(){
initgraph(500,500);
circle(250,250,230);
while(1);
return 0;
}
3.2 Package easyx project template: once and for all
After the above successful operations, we can already use the Easyx graphics library in Dev-Cpp, but it is troublesome to configure the link every time it is opened, so we choose: Encapsulate the easyx project template: once and for all [In the future, directly create a new project and select the easyx template. Yes, it smells delicious! 】
Generating project templates simplifies the process:
Click File --> New --> Template, fill in the template name: EasyX (according to your own wishes here), other options can be filled in according to your own preferences.