编译链接问题

问题描述

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"
}
相关推荐
weixin_446729164 分钟前
注解和反射
java·开发语言
এ慕ོ冬℘゜9 分钟前
JS 前端基础高频面试题
开发语言·前端·javascript
凯瑟琳.奥古斯特12 分钟前
常见加密算法及应用
java·开发语言·网络·网络协议·职场和发展
Dxy123931021615 分钟前
JS列表获取指定范围值的 N 种方法
开发语言·javascript·ecmascript
froginwe1117 分钟前
Memcached CAS 命令详解
开发语言
春栀怡铃声27 分钟前
【C++修仙录02】筑基篇:vector 使用
开发语言·c++·算法
彦为君28 分钟前
JavaSE-11-ByteBuffer(NIO核心组件)
java·开发语言·前端·数据库·后端·spring·nio
茉莉玫瑰花茶28 分钟前
LangGraph 持久化(Persistence)[ 2 ]
开发语言·python·ai·langgraph
Dxy123931021631 分钟前
`...` 展开运算符(Spread Operator)详解
开发语言·javascript
有味道的男人33 分钟前
AI 对接 1688 图搜接口|Open Claw 以图搜货实战
开发语言·python