gpt4 book ai didi

c - VSCode包含c中的头文件

转载 作者:行者123 更新时间:2023-11-30 16:10:33 25 4
gpt4 key购买 nike

我正在尝试在 c 中使用我的头文件。当我使用代码块时,它处理 header 包含部分,但在 vs code 中,我还无法弄清楚。这就是我在 vs code 中得到的。这些文件位于同一文件夹中。我正在使用 gcc。

#include "assPQ.h"

。。.

PS C:\Users\xxx\Desktop\xxxx\ass> cd "c:\Users\xxx\Desktop\xxxx\ass\" ; if ($?) { gcc coffeeShopSimulator.c -o coffeeShopSimulator } ; if ($?) { .\coffeeShopSimulator }
c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: C:\Users\xxx\AppData\Local\Temp\cc6RasGF.o:coffeeShopSimulator.c:(.text+0xf): undefined reference to `CreateListPQ'

最佳答案

我解决了这个问题,可能是因为 VS code 不是 IDE,你只能通过这样做来链接

#include "header.c"

主要是.

header 本身发生的事情是您需要将“header.h”链接到“header.c”,并将“header.c”链接到“main.c”。

希望这对其他人有帮助。如果有其他技术解释,我很高兴听到。

关于c - VSCode包含c中的头文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58866963/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com