编译链接问题

问题描述

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 小时前
pywinauto-打开程序+连接已打开的程序
开发语言·python
Ws_8 小时前
C#学习 Day2
开发语言·学习·c#
杰克尼8 小时前
天机学堂复习总结(day03-day04)
java·开发语言·redis·elasticsearch·spring cloud
x***r1519 小时前
jdk-11.0.16.1_windows使用步骤详解(附JDK 11环境变量配置与验证教程)
java·开发语言·windows
luck_bor9 小时前
File类&递归作业
java·开发语言
枕星而眠13 小时前
数据结构八大排序详解(一):四大简单排序
c语言·数据结构·c++·后端
努力努力再努力wz13 小时前
【Qt入门系列】:按钮组件全解析:从 QAbstractButton 到快捷键事件、单选与复选机制
c语言·开发语言·数据结构·c++·git·qt·github
skywalk816314 小时前
言知(Yanzhi)系统提升建议报告和完工报告 by AutoCoder
开发语言·编程
yunn_14 小时前
单例模式两种实现方法
开发语言·c++·单例模式
我材不敲代码14 小时前
Python基础:列表详解、增删改查及常用高阶操作
开发语言·windows·python