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\""
        }
    ]
}
相关推荐
oooost20 小时前
Jupyter Notebook 常用快捷键速查
ide·python·jupyter
承渊政道1 天前
Linux系统学习【线程概念与控制核心知识详解】
linux·运维·vscode·学习·ubuntu·线程创建 终止 等待
yqj2341 天前
ESP32-S3中小智项目优化内容
ide·macos·xcode
阿斌.com1 天前
Visual Studio 2026安装全攻略
ide·visual studio
我要神龙摆尾2 天前
IDEA 阅读插件
java·ide·intellij-idea·idea-plugs·plugs
梦幻通灵2 天前
IDEA 实用快捷键【持续更新】
java·ide·intellij-idea
星辰徐哥2 天前
鸿蒙平台 KDevelop 集成开发环境适配实战:基于 Electron 壳方案的跨平台多语言代码编辑器开发
electron·编辑器·harmonyos
风华同学3 天前
vscode远程连接
ide·vscode·编辑器
sunoo-2293 天前
【嵌入式 ARM 学习第十二天】SPI 裸机驱动 + I2C 触摸屏驱动 + 三大串行协议深度对比
arm开发·笔记·vscode·学习·imx6ull
kiss strong3 天前
idea显示前进后退按钮
java·ide·intellij-idea