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\""
        }
    ]
}
相关推荐
q***0567 小时前
PhpStorm下载、安装、配置教程
ide·phpstorm
Java开发追求者10 小时前
vscode导入springboot项目
java·ide·spring boot·vscode
johnny23310 小时前
AI IDE/插件(三):Task Master、DeepCode
ide·人工智能
玖日大大14 小时前
Trae:字节跳动 AI 原生 IDE 的技术革命与实战指南
ide·人工智能
胖咕噜的稞达鸭15 小时前
包管理器,yum工具,vim编辑器常见指令,解决sudo权限问题,Linux项目自动化构建工具-make/Makefile
linux·编辑器·vim
初级代码游戏17 小时前
MAUI劝退:visual studio 2026尚不支持本地iOS设备(必须和mac配对)
ide·visual studio
葡萄城技术团队19 小时前
Web 无障碍工程化实战:VSCode 扩展 + AI 自动修复全解析
前端·vscode·产品运营
指尖的爷19 小时前
VsCode远程开发SSH连接失败
ide·vscode·ssh
不染尘.19 小时前
C++中的易混点2
开发语言·数据结构·c++·vscode·算法
shayudiandian1 天前
用VSCode打造AI开发环境
人工智能·vscode