编译链接问题

问题描述

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"
}
相关推荐
larance25 分钟前
机器学习特征预处理之标准化/归一化
开发语言·python·机器学习
农村小镇哥41 分钟前
C#中的字符串格式化
服务器·开发语言·c#
Navigator_Z1 小时前
LeetCode //C - 1156. Swap For Longest Repeated Character Substring
c语言·算法·leetcode
无相求码1 小时前
const vs #define:C语言常量定义的差异
c语言·算法
Android洋芋2 小时前
AI辅助C盘清理
c语言·开发语言·人工智能·ai辅助c盘清理
ScilogyHunter2 小时前
GCC/Clang 原始字符串详解
c语言·原始字符串
灯澜忆梦3 小时前
Go 语言 _JSON---序列化与反序列化
开发语言·golang·json
麻瓜老宋3 小时前
AI开发C语言应用按步走,表达式计算器calc的第四步,交互式 REPL 模式
c语言·开发语言·atomcode
猫猫不是喵喵.3 小时前
双亲委派机制与类加载过程
java·开发语言
布朗克1684 小时前
Go入门到精通-22-同步原语
开发语言·后端·golang·同步原语