编译链接问题

问题描述

C语言在编译的时候,提示链接的时候没有找到相应的方法

问题分析

代码文件结构:

test.c

test/1.c

test/1.h

test.c代码:

#include "test/1.h"

void main() {

hello();

}

test/1.c代码:

void hello() {

printf("hello");

}

test/1.h代码:

#include "stdio.h"

void hello();

问题解决

由于IDE使用的是vscode, 它使用json文件来管理编译,需要修改json文件:

task.json文件:

cpp 复制代码
{
    "tasks": [
        {
            "type": "cppbuild",
            "label": "C/C++: cl.exe build active file",
            "command": "cl.exe",
            "args": [
                "/Zi",
                "/EHsc",
                "test\\1.c",//修改这里
                "/Fe${fileDirname}\\${fileBasenameNoExtension}.exe",
                "${file}"
            ],
            "options": {
                "cwd": "${fileDirname}"
            },
            "problemMatcher": [
                "$msCompile"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "detail": "Task generated by Debugger."
        }
    ],
    "version": "2.0.0"
}
相关推荐
魔力女仆3 小时前
分享一个 JS 鼠标跟随贪吃蛇背景库
开发语言·javascript·计算机外设
2401_894915534 小时前
GEO 搜索优化完整源码从零部署:环境配置、集群搭建全流程
开发语言·python·tcp/ip·算法·unity
麻瓜老宋4 小时前
AI开发C语言应用按步走,表达式计算器calc的第二十二步,分号赋值链式修复、TOKEN_ASSIGN
c语言·开发语言·atomcode
颜x小6 小时前
[C#] C++与c#语法对比
开发语言·c++·c#
weixin_423652137 小时前
C#使用JObject
开发语言·c#
国科安芯7 小时前
FreeRTOS RISC-V 浮点上下文切换移植:在 IAR 工程中完整保存 FPU 寄存器
java·开发语言·单片机·嵌入式硬件·算法·系统架构·risc-v
霸道流氓气质8 小时前
Java中集成Smile 技术教程:从入门到工程实践
java·开发语言
BerrySen1789 小时前
迈向 Next-Gen Java:企业级高并发架构演进与大模型 Agent 落地深度实战
java·开发语言·架构
SilentSlot9 小时前
【C/C++】手写 DPDK 协议栈(十一):基于 PPS、SYN 比例和源 IP 熵的 DDoS 检测
c语言·c++·tcp/ip
Nebula_g9 小时前
Java实现本地Socket通信(三)
java·开发语言·学习·socket·可视化