编译链接问题

问题描述

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"
}
相关推荐
我是唐青枫19 分钟前
Java Spring Data JPA 实战指南:Repository 查询、分页与实体映射
java·开发语言
张忠琳34 分钟前
【Go 1.26.4】(Part 2) Go 1.26.4 超深度分析 — Runtime GMP 调度器 (proc.go + runtime2.go)
开发语言·golang
阿坤带你走近大数据1 小时前
java中泛型不能用基础数据类型
java·开发语言
weixin_307779131 小时前
从脚本执行到智能体协作:AI辅助测试能力的范式重构
运维·开发语言·人工智能·算法·测试用例
云絮.1 小时前
增删改查操作
java·开发语言
themingyi1 小时前
Abaqus2024安装python包pandas
开发语言·python·pandas
阿正的梦工坊1 小时前
【Rust】19-FFI、ABI 与跨语言边界设计
开发语言·后端·rust
殇淋狱陌2 小时前
Python列表知识思维导图
开发语言·python·学习
代码中介商2 小时前
C++ 智能指针完全指南(三):weak_ptr 与循环引用
开发语言·c++
fox_lht2 小时前
第十五章 函数式语言:迭代器和闭包
开发语言·后端·学习·算法·rust