c - VSCode包括c中的头文件
问题描述
我正在尝试在 c 中使用我的头文件。当我使用代码块时,它会处理标题包含部分,但在 vs 代码中,我还无法弄清楚。这就是我在 vs 代码中得到的。这些文件位于同一文件夹中。我正在使用 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 代码不是 IDE,你只能通过这样做来链接
#include "header.c"
在主要。
标题本身发生的事情是您需要将“header.h”链接到“header.c”和“header.c”链接到“main.c”。
希望这将有助于任何其他人。如果有其他技术解释,我很高兴听到。
推荐阅读
- arrays - 逆波兰表示法 - C 中的数组、向量、标量
- javascript - 如何调试 Node + Socket.io CPU 问题,除了连接 100% cpu 什么都不做
- python - Bot 获取并回复关于 Twitter 问题的提及
- sql - Postgres SQL函数和触发器在另一个表中插入记录
- deepsecurity - 使用 API 将激活码放入趋势科技服务器深度安全防护系统管理中心 - 500 错误代码
- sql - sql 中的 case 表达式以在用户提示的情况下打印所需的文本
- javascript - 带有条件的 React 按钮组件不起作用并显示
- architecture - 领域驱动设计共享实体
- php - 您可以将多个 Oracle SQL 查询的结果放入一个 CSV 文件中吗?
- c# - 如何使用 ApiKey 授权进行简单的 Get?