编译链接问题

问题描述

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"
}
相关推荐
牛奔29 分钟前
Go 如何打印调试深层或嵌套的结构体
开发语言·后端·golang
2601_9516443242 分钟前
C语言二级备考指南
c语言·编程基础·编译环境·二级考试·题库选择
geovindu1 小时前
go: Iterative Algorithms
开发语言·后端·算法·golang·迭代算法
学逆向的1 小时前
汇编——JCC指令
开发语言·汇编·网络安全
mayaairi2 小时前
JS循环语句深度解析:嵌套for、while与do...while
开发语言·前端·javascript
kite01212 小时前
Go语言Map深度解析与最佳实践
开发语言·后端·golang
l156469484 小时前
突围!图文混合知识库难以解析,Kimi-K3 原生视觉架构深耕知识工作,DMXAPI 统一接口,缩短项目开发周期
java·大数据·开发语言
charlie1145141914 小时前
现代C++工程实践 WeakPtr 实战(三):WeakPtrFactory 与「最后成员」惯用法
开发语言·c++·开源项目·现代c++
日拱一卒——功不唐捐5 小时前
红黑树删除(C语言)
c语言·数据结构
IT小盘6 小时前
04-大模型流式输出原理-SSE与Python实现
开发语言·网络·人工智能·python