删除了例子,开始正式设计
重新设计的编译流程
This commit is contained in:
parent
2e5ca0e8db
commit
3d07326a12
|
@ -12,9 +12,7 @@ include_directories(
|
|||
${PROJECT_SOURCE_DIR}/include/
|
||||
)
|
||||
|
||||
add_subdirectory(lib)
|
||||
aux_source_directory(./src SRC)
|
||||
|
||||
# 产生可执行文件
|
||||
add_executable(bus main.c)
|
||||
|
||||
target_link_libraries(bus bus_lib)
|
||||
add_executable(bus main.c ${SRC})
|
22
include/bus.h
Normal file
22
include/bus.h
Normal file
|
@ -0,0 +1,22 @@
|
|||
#ifndef AUTO_PILOT_BUS_BUS_H
|
||||
#define AUTO_PILOT_BUS_BUS_H
|
||||
|
||||
#include "rail.h"
|
||||
|
||||
struct {
|
||||
/**
|
||||
* 指向站点的指针
|
||||
*/
|
||||
rail_node_t* rail_node_pos;
|
||||
/**
|
||||
* 当前行进的距离
|
||||
*/
|
||||
int distance;
|
||||
} bus;
|
||||
|
||||
/**
|
||||
* 表示公交车的结构体
|
||||
*/
|
||||
typedef struct bus bus_t;
|
||||
|
||||
#endif //AUTO_PILOT_BUS_BUS_H
|
|
@ -1,11 +0,0 @@
|
|||
//
|
||||
// Created by ricardo on 2022/4/29.
|
||||
//
|
||||
|
||||
#ifndef AUTO_PILOT_BUS_EXAMPLE_H
|
||||
#define AUTO_PILOT_BUS_EXAMPLE_H
|
||||
|
||||
#include "stdio.h"
|
||||
|
||||
void print(char* str);
|
||||
#endif //AUTO_PILOT_BUS_EXAMPLE_H
|
32
include/rail.h
Normal file
32
include/rail.h
Normal file
|
@ -0,0 +1,32 @@
|
|||
#ifndef AUTO_PILOT_BUS_RAIL_H
|
||||
#define AUTO_PILOT_BUS_RAIL_H
|
||||
|
||||
struct {
|
||||
/**
|
||||
* 站点的编号
|
||||
*/
|
||||
int id;
|
||||
/**
|
||||
* 距离上一个站点的距离
|
||||
*/
|
||||
int last_node_distance;
|
||||
/**
|
||||
* 距离下一个站点的距离
|
||||
*/
|
||||
int next_node_distance;
|
||||
/**
|
||||
* 指向上一个站点的指针
|
||||
*/
|
||||
struct rail_node* last_node;
|
||||
/**
|
||||
* 指向下一个站点的指针
|
||||
*/
|
||||
struct rail_node* next_node;
|
||||
} rail_node;
|
||||
|
||||
/**
|
||||
* 表示轨道上的一个站点的结构体
|
||||
*/
|
||||
typedef struct rail_node rail_node_t;
|
||||
|
||||
#endif //AUTO_PILOT_BUS_RAIL_H
|
|
@ -1,5 +0,0 @@
|
|||
aux_source_directory(. LIB_SRCS)
|
||||
|
||||
include_directories(../include)
|
||||
|
||||
add_library(bus_lib ${LIB_SRCS})
|
|
@ -1,14 +0,0 @@
|
|||
//
|
||||
// Created by ricardo on 2022/4/29.
|
||||
//
|
||||
#include "example.h"
|
||||
|
||||
/**
|
||||
* @brief 在stdin打印一个字符串
|
||||
*
|
||||
* @param str 指向需要打印的字符串指针
|
||||
*/
|
||||
void print(char* str)
|
||||
{
|
||||
printf("%s", str);
|
||||
}
|
9
main.c
9
main.c
|
@ -1,4 +1,4 @@
|
|||
#include "example.h"
|
||||
#include "stdio.h"
|
||||
|
||||
/**
|
||||
* @brief 程序的主函数
|
||||
|
@ -7,11 +7,6 @@
|
|||
*/
|
||||
int main()
|
||||
{
|
||||
/**
|
||||
* @brief 需要输出的字符串
|
||||
*
|
||||
*/
|
||||
char* string = "Good morning!\n";
|
||||
print(string);
|
||||
printf("同志们加油啊,不然要寄啦!\n");
|
||||
return 0;
|
||||
}
|
1
src/rail.c
Normal file
1
src/rail.c
Normal file
|
@ -0,0 +1 @@
|
|||
#include "rail.h"
|
Loading…
Reference in New Issue
Block a user