简体   繁体   English

VSCode 包括 c 中的 header 文件

[英]VSCode including header file in c

I'm trying to work with my header files in c.我正在尝试使用 c 中的 header 文件。 When i use code blocks, it handles the header include part, but in vs code, i couldn't figure it out yet.当我使用代码块时,它处理 header 包含部分,但在 vs 代码中,我还无法弄清楚。 this is what i get in vs code.这就是我在 vs 代码中得到的。 The files are in the same folder.这些文件位于同一文件夹中。 I am using gcc.我正在使用 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'

i fixed the problem, probably because VS code is not an IDE you can only link by doing this我解决了这个问题,可能是因为 VS 代码不是 IDE 你只能通过这样做链接

#include "header.c"

in the main.在主要。

What happens in the header itself is you need to link the "header.h" into "header.c" and "header.c" linked into "main.c". header 本身发生的情况是您需要将“header.h”链接到“header.c”和“header.c”链接到“main.c”。

Hopefully, this will help any other person.希望这将有助于任何其他人。 If there is another technical explanation, I'm happy to hear.如果有其他技术解释,我很高兴听到。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM