demo.h

#ifndef UNTITLED_HEADER_DEMO_H
#define UNTITLED_HEADER_DEMO_H

void printHello(char *name);

#endif //UNTITLED_HEADER_DEMO_H

demo.c

//
// Created by gxf on 2020/2/6.
//
#include <stdio.h>

#include "header-demo.h"

void printHello(char *name) {
    printf("hello %s\n", name);
}

main.c

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include "header-demo.h"

int main() {
    char *name = "guanxianseng";
    printHello(name);

    return 0;
}

cmakelist.txt

# main.c
add_executable(main main.c header-demo.h header-demo.c)

  

相关文章:

  • 2021-09-30
  • 2022-12-23
  • 2022-12-23
  • 2022-02-06
  • 2021-07-02
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-10-16
  • 2020-10-18
  • 2022-12-23
  • 2022-01-09
相关资源
相似解决方案