编译链接问题

问题描述

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"
}
相关推荐
JSUITDLWXL12 分钟前
ideal2022.3.1版本编译项目报java: OutOfMemoryError: insufficient memory
java·开发语言
magic 24516 分钟前
Java建造者模式(Builder Pattern)详解与实践
java·开发语言·建造者模式
前端小崔18 分钟前
前端面试题之ES6保姆级教程
开发语言·前端·javascript·面试·职场和发展·ecmascript·es6
Love__Tay43 分钟前
【学习笔记】Python金融基础
开发语言·笔记·python·学习·金融
Lilith的AI学习日记1 小时前
什么是预训练?深入解读大模型AI的“高考集训”
开发语言·人工智能·深度学习·神经网络·机器学习·ai编程
wangjinjin1801 小时前
Python Excel 文件处理:openpyxl 与 pandas 库完全指南
开发语言·python
愚润求学1 小时前
【C++】类型转换
开发语言·c++
XRZaaa2 小时前
常见排序算法详解与C语言实现
c语言·算法·排序算法
斯奕sky_small-BAD2 小时前
C++ if语句完全指南:从基础到工程实践
java·开发语言·php
Humbunklung2 小时前
Rust Floem UI 框架使用简介
开发语言·ui·rust