Eclipse - Create a new C project [新建 C 工程]
/*
============================================================================
Name : hello_world.c
Author : Yongqiang Cheng
Version : Version 1.0.0
Copyright : Copyright (c) 2019 Yongqiang Cheng
Description : Hello World in C, Ansi-style
============================================================================
*/
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
puts("!!!Hello World!!!"); /* prints !!!Hello World!!! */
return EXIT_SUCCESS;
}
1. Eclipse IDE Launcher
Select a directory as workspace -> Launch
Workspace: /home/strong/dbscan_work
2. Welcome to the Eclipse IDE for C/C++ Developers
Create a new C project -> Next
Create a new Eclipse project for C source code
3. C Project
Select Configurations -> Next
the_dbscan_clustering_algorithm
4. C Project
Basic Settings -> Next
Author: Foreverstrong Cheng
5. C Project
Select Configurations -> Finish
Debug / Release
6. the_dbscan_clustering_algorithm
7. Build ‘Debug’ for project ‘the_dbscan_clustering_algorithm’
10:59:37 **** Build of configuration Debug for project the_dbscan_clustering_algorithm ****
make all
Building file: ../src/the_dbscan_clustering_algorithm.c
Invoking: GCC C Compiler
gcc -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/the_dbscan_clustering_algorithm.d" -MT"src/the_dbscan_clustering_algorithm.o" -o "src/the_dbscan_clustering_algorithm.o" "../src/the_dbscan_clustering_algorithm.c"
Finished building: ../src/the_dbscan_clustering_algorithm.c
Building target: the_dbscan_clustering_algorithm
Invoking: GCC C Linker
gcc -o "the_dbscan_clustering_algorithm" ./src/the_dbscan_clustering_algorithm.o
Finished building target: the_dbscan_clustering_algorithm
10:59:38 Build Finished (took 906ms)
8. Run
9. Includes
项目创建完成后,出现如下项目文件目录结构,Includes 里面是支持项目正常运行所必须的 lib。
10. Build Project
选中 Project 右键 -> Build Configurations -> Build All
选中 Project 右键 -> Build Configurations -> Clean All
选中 Project 右键 -> Build Project
11. Binaries - Debug - Release
Binaries
存放编译后的二进制文件,主要是用于 Debug,Release 的二进制文件。Binaries 目录只能在 Eclipse 中才能看到,从电脑磁盘上面是直接看不到的。
Debug
包含文件 (.exe 与 .o)。这里 .exe 文件是可以直接执行的文件,因为在 Debug 目录里面,表明只用于debug。.o 文件是一个 object 文件,即目标文件,编译器产生的,对源代码的直译,未经过连接等操作的目标代码。(代码编译后生成目标文件 (.o 文件),目标文件经过连接后才能变成 .exe 文件)。
Release
包含文件 (.exe 与 .o)。这里 .exe 文件是可以直接执行的文件,因为在 Release 目录里面,表明只用于发布运行。.o 文件是一个 object 文件,即目标文件,编译器产生的,对源代码的直译,未经过连接等操作的目标代码。(代码编译后生成目标文件 (.o 文件),目标文件经过连接后才能变成 .exe 文件)。
12. Run
单击 Release 目录下面的 .exe 文件 -> 右键,选择 Run As -> Local C/C++ Application 运行程序。在 Eclipse 的 Debug 视图下面单击工具栏中的 Debug 图标即可自动执行 Debug 目录下的 .exe 文件。
References
[1] Yongqiang Cheng, https://yongqiang.blog.csdn.net/