编译链接问题

问题描述

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"
}
相关推荐
李永奉1 小时前
C语言-指针初级(指针定义、指针的作用、指针的计算、野指针、悬空指针、void类型指针)
c语言·开发语言
Full Stack Developme1 小时前
Java 日期时间处理:分类、用途与性能分析
java·开发语言·数据库
2301_793086875 小时前
JVM 01 运行区域
java·开发语言
愤怒的小鸟~~~5 小时前
c语言创建的一个队列结构(含有这个头指针和这个尾指针的结构具有一定的参考价值)
c语言·开发语言·算法
鹿野素材屋7 小时前
C#中对于List的多种排序方式
开发语言·c#
whxnchy7 小时前
C++刷题 - 7.27
开发语言·c++
白日梦想家-K8 小时前
题单【模拟与高精度】
开发语言·c++·算法
鹦鹉0078 小时前
IO流中的字节流
java·开发语言·后端
重生之我是Java开发战士8 小时前
【C语言】内存函数与数据在内存中的存储
c语言·开发语言·算法
haaaaaaarry8 小时前
Element Plus常见基础组件(二)
开发语言·前端·javascript