外部库不起作用C / C ++Visual Studio代码

问题描述

我是一名就读CS大学的新生。我正在学习C,我们必须使用一些外部库。当我包含这些库时,虽然没有出现任何问题,但是当我使用库特定的语法(例如GetInteger)与代码输出时:“未定义对GetInteger的引用”

这是一个简单的例子:

#include <stdio.h>
#include "simpio.h"
#include "genlib.h"
#include <stdlib.h>

int main()
{
   int age;
   printf("Whats your age?\n");
   
   age=GetInteger();
   printf("Your age is %d",age);
   return 0;
}

这些是我的c_ccp_properties.json:

{
    "configurations": [
        {
            "name": "Win32","includePath": [
                "${workspaceFolder}/**","C:\\MinGW\\include","C:\\MinGW\\lib","C:\\MinGW\\lib\\gcc\\mingw32\\6.3.0"
            ],"defines": [
                "_DEBUG","UNICODE","_UNICODE"
            ],"compilerPath": "C:\\MinGW\\bin\\gcc.exe","cStandard": "gnu11","cppStandard": "gnu++14","intelliSenseMode": "gcc-x86"
        }
    ],"version": 4
} 

我的launch.sjon:

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information,visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0","configurations": [
        {
            "name": "gcc.exe - Build and debug active file","type": "cppdbg","request": "launch","program": "${fileDirname}\\${fileBasenameNoExtension}.exe","args":["-g","-o","out.exe","main.cpp","test.c"],"stopAtEntry": false,"cwd": "${workspaceFolder}","environment": [],"externalConsole": false,"MIMode": "gdb","miDebuggerPath": "\\usr\\bin\\gdb.exe","setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb","text": "-enable-pretty-printing","ignoreFailures": true
                }
            ],"prelaunchTask": "C/C++: gcc.exe build active file"
        }
    ]
}

和我的task.json:

{
    // See https://go.microsoft.com/fwlink/?LinkId=733558
    // for the documentation about the tasks.json format
    "version": "2.0.0","tasks": [
        {
            "type": "shell","label": "g++ build active file","command": "/usr/bin/g++","args": [],"options": {
                "cwd": "/usr/bin"
            }
        }]
}

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)