Quantcast
Channel: Active questions tagged visual-studio-code - Stack Overflow
Viewing all articles
Browse latest Browse all 98506

tasks.json for SDL helloWorld app on Mac with Visual Studio Code

$
0
0

I'm trying to learn how to use SDL on Mac, I have a working example running from command line with this structure :

 include (directory with the SDL include folder)
 lib (directory with the SDL lib folder)
 main.cpp
 makeFile

The content of my makefile is the following:

game:
    g++ main.cpp -o play -I include -L lib -l SDL2

As I have already mentioned everything works. Now I would like to use the Visual Studio Code and configure the project so I have create a tasks.json like the following:

{
    // See https://go.microsoft.com/fwlink/?LinkId=733558 
    // for the documentation about the tasks.json format

        "version": "2.0.0",
        "tasks": [
            {
                "label": "build",
                "command": "g++",
                "args": [
                    "main.cpp", // main file
                    "-o",
                    "play", // executable
                    "-I include",
                    "-L lib", 
                    "-l SDL2"
                ],
                "type": "shell",
                "presentation": {
                    "echo": true,
                    "reveal": "always",
                    "panel": "shared"
                },
                "problemMatcher": {
                    "owner": "cpp",
                    "fileLocation": [
                        "relative",
                        "${workspaceRoot}"
                    ],
                    "pattern": {
                        "regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
                        "file": 1,
                        "line": 2,
                        "column": 3,
                        "severity": 4,
                        "message": 5
                    }
                }
            }
        ]
    }

But I'm getting the following error:

> Executing task: g++ main.cpp -o play '-I include''-L lib''-l SDL2'<

ld: warning: directory not found for option '-L lib'
ld: library not found for -l SDL2
clang: error: linker command failed with exit code 1 (use -v to see invocation)
The terminal process terminated with exit code: 1

Terminal will be reused by tasks, press any key to close it.

Do you have any idea about what can be the problem?


Viewing all articles
Browse latest Browse all 98506

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>