Preface
After the ARA2C project makefile, the next attempt to move the ARIA2C project to Eclipse (Linux:ubantu) for easy debugging. (not dependent on IDE debugging, so far not skilled, so to speed up understanding of the project, use the IDE to debug it). First, install Eclipse
1 Install Eclipse Enter the following command in terminal to test whether Eclipse is installed:
Eclipse
If it is not installed, you will be prompted to use what commands to install Eclipse, such as the following command to install the required JDK and other dependencies:
sudo apt install eclipse-platform
At this point, the installed eclipse should be the default hidden menu bar, refer to the Eclipse in Ubuntu menu bar display problem.
sudo gedit/etc/profile
At the end of the file add export ubuntu_menuproxy=0 Save and restart the system, you can see the Eclipse icon in the menu bar.
2 Configure the C + + development environment using the following command:
sudo apt-get install build-essential
sudo apt-get install ECLIPSE-CDT
Restart Eclipse to create a C + + project to test. 3, testing
Create a new project: File->new->c++project->executable->empty project. Fill in the project name: Cpptry
Toolchains (This is related to the compiler, if the MinGW chooses Cross, if the GNU chooses Linux gcc): Cross gcc, as shown below.
Complete the project setup by completing the next successive step.
Right-click the item to add a source File named Main.cpp
* * * * * main.cpp * * Created on:apr, 2018
* author:cong/
#include <stdio.h>
int Add (int-A, int second)
{return a
/second;
}
int main ()
{
printf ("hello\n");
int First,second;
scanf ("%d%d", &first, &second);
printf ("%d +%d =%d", second, add (I, second));
return 0;
}
Finally, the compiler (the most critical step) is developed. For example, you can specify X86_64-W64-MINGW32-GCC or X86_64-LINUX-GNU-GCC (GCC), which is 64bit. Right-click the project project->properties and c/c++build->settings the GCC C COMPILER,GCC C + +, linker, and Assembler commands in the pop-up box, respectively x86_64- W64-MINGW32-GCC, x86_64-w64-mingw32-g++, x86_64-w64-mingw32-g++ and X86_64-w64-mingw32-as may be filled in directly x86_64- W64-MINGW32-GCC compilation prompts X86_64-W64-MINGW32-GCC not found. If so, you need to fill in the full path of the corresponding command.
You can know the path where the compiler is specified
which X86_64-W64-MINGW32-GCC
ii. configuration of ARIA2C projects
The prerequisite system installs the corresponding library file, detailed look: https://blog.csdn.net/qq_33850438/article/details/80199588
Complete the previous configuration, the rest is simpler, but more cumbersome. Here's an example of x86_64-w64-mingw32 (note that the resulting EXE can only run on Windows, and that you want to debug Linux in the next configuration, and that you need to configure X86_64-LINUX-GNU.) I've tried it all.)
When the project was first compiled, there was no coherent to import the required source files, eliminating the need for source files and so on.
then, depending on the configure and makefile.am files, you can well know the installation environment that the system has been prepared for. At this point, you can find out which files need to be compiled and which do not need to be./configure the results are as follows:
You can also see from the diagram above what option parameters are required when compiling a link. Next, configure the project's compilation parameters.
1, the overall structure of the project (red box)
2, Project cross GCC compiler compile configuration. (-I Development header file path)
3, the project cross g++ compiler compile configuration.
4, the project cross g++ linker link configuration. (-l Develop some library file paths. -L Develop library files)
5, Cross GCC Assembler assembly configuration.
At this point, the basic configuration of the project completed, follow-up encountered problems, need to think slowly, can be resolved.
(You can refer to the project to automatically generate makefile files.) Print out the statement of its makefile execution process to analyze, make-n. This makes it clear how the auto-generated makefile compiles the linked items so that we can more easily configure the eclipse's parameters) Iii. Summary of the Harvest
By writing makefile, you can clearly know the process of compiling a project to generate each file, the required library files, paths, compilation link parameters, and so on. Using the IDE, it is also a methodical execution to configure these parameters so that their compilation links work. You can see this clearly by looking at the IDE's compile window.
In the process of compiling or linking problems, can be targeted analysis to solve. (therefore, it is still necessary to learn makefile)
Iv. Reference
Eclipse Configuration: https://blog.csdn.net/colin_lisicong/article/details/70939143
https://blog.csdn.net/wang_shuai_ww/article/details/17227145
Written by ARIA2C's makefile file: https://blog.csdn.net/qq_33850438/article/details/80009669