C header issue: #include and “undefined reference”

前端 未结 5 598
无人共我
无人共我 2021-02-03 22:14

Alright, I\'ve been trying to work with this for the longest time, and I simply can\'t seem to get it to work right. I have three files, main.c, hello_world.c

5条回答
  •  离开以前
    2021-02-03 22:40

    Ya it seems you have forgotten to link hello_world.c. I will be gcc hello_world.c main.c -o main. If the number of files are less we can use this approach but in larger projects better to use Make files or some compilation scripts.

提交回复
热议问题