vscode 配置第三方库 opengl 开发

c_cpp_properties.json

{
    "configurations": [
        {
            "name": "Win32",
            "includePath": [
                "${workspaceFolder}/**",
                "D:\\Professional\\Third_Library\\3DGIS\\OpenGL\\freeglut\\include",
                "D:\\Professional\\Third_Library\\3DGIS\\OpenGL\\glew-2.1.0-win32\\glew-2.1.0\\include" //glew
            ],
            "defines": [
                "_DEBUG",
                "UNICODE",
                "_UNICODE"
            ],
            "windowsSdkVersion": "10.0.19041.0",
            "compilerPath": "C:/Program Files/MinGW/mingw64/bin/g++.exe",
            "cStandard": "c11",
            "cppStandard": "c++11",
            "intelliSenseMode": "gcc-x64"
        }
    ],
    "version": 4
}

launch.json

{
    // 使用 IntelliSense 了解相关属性。 
    // 悬停以查看现有属性的描述。
    // 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "(gdb) 启动",
            "type": "cppdbg",
            "request": "launch",
            "program": "${fileDirname}\\${fileBasenameNoExtension}.exe",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${fileDirname}",
            "environment": [],
            "externalConsole": false,
            "MIMode": "gdb",
            "miDebuggerPath": "C:\\Program Files\\MinGW\\mingw64\\bin\\gdb.exe",
            "setupCommands": [
                {
                    "description": "为 gdb 启用整齐打印",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                },
                {
                    "description": "将反汇编风格设置为 Intel",
                    "text": "-gdb-set disassembly-flavor intel",
                    "ignoreFailures": true
                }
            ],
            "preLaunchTask": "C/C++: g++.exe 生成活动文件"    //与tasks.json中的label相同
        }

    ]
}

tasks.json

{
	"version": "2.0.0",
	"tasks": [
        {
            "type": "cppbuild",
            "label": "C/C++: g++.exe 生成活动文件",
            "command": "C:\\Program Files\\MinGW\\mingw64\\bin\\g++.exe",
            "args": [
                "-D GLEW_STATIC", //因为我们链接的是静态库,使用该宏告知glew
                "-fdiagnostics-color=always",
                "-g",
                "${fileDirname}\\*.cpp",
                "D:\\Professional\\Third_Library\\3DGIS\\OpenGL\\freeglut\\lib\\x64\\libfreeglut.a", //链接至freeglut库
                "D:\\Professional\\Third_Library\\3DGIS\\OpenGL\\glew-2.1.0-win32\\glew-2.1.0\\lib\\Release\\x64\\glew32s.lib", //链接至glew静态库
                "-lopengl32", //链接系统中的opengl32库
                "-lgdi32", //链接系统中的gdi32库
                "-o",
                "${fileDirname}\\${fileBasenameNoExtension}.exe",
                "--include-directory=D:\\Professional\\Third_Library\\3DGIS\\OpenGL\\freeglut\\include", //确保头文件的包含
                "--include-directory=D:\\Professional\\Third_Library\\3DGIS\\OpenGL\\glew-2.1.0-win32\\glew-2.1.0\\include" //确保头文件的包含
            ],
            "options": {
                "cwd": "${fileDirname}"
            },
            "problemMatcher": [
                "$gcc"
            ],
            "group": {
                "kind": "test",
                "isDefault": true
            },
            "detail": "编译器: \"C:\\Program Files\\MinGW\\mingw64\\bin\\g++.exe\""
        }
    ]
}
相关推荐
Mortal_hhh15 分钟前
VScode的C/C++点击转到定义,不是跳转定义而是跳转声明怎么办?(内附详细做法)
ide·vscode·stm32·编辑器
无极程序员40 分钟前
PHP常量
android·ide·android studio
小黄人软件3 小时前
android浏览器源码 可输入地址或关键词搜索 android studio 2024 可开发可改地址
android·ide·android studio
叶知安7 小时前
如何用pycharm连接sagemath?
ide·python·pycharm
电子云与长程纠缠10 小时前
UE5.3中通过编辑器工具创建大纲菜单文件夹
java·ue5·编辑器
会发光的猪。10 小时前
如何在vscode中安装git详细新手教程
前端·ide·git·vscode
lucky九年11 小时前
vscode翻译插件
ide·vscode·编辑器
帅得不敢出门11 小时前
Gradle命令编译Android Studio工程项目并签名
android·ide·android studio·gradlew
ZHOUPUYU11 小时前
IntelliJ IDEA超详细下载安装教程(附安装包)
java·ide·intellij-idea