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\""
        }
    ]
}

你可能感兴趣的:(配置,vscode,ide,编辑器)