Visual studio code + kompilator z VS2017

0

Zainstalowałem Visual Studio 2017 Community oraz Visual Studio Code + C/C++ extension. Chcę zbudować program z wykorzystaniem kompilatora z Visual Studio. Utworzyłem task budowania msbuild, ale budowanie się nie udaje:

> Executing task: msbuild /property:GenerateFullPaths=true /t:build <

msbuild : The term 'msbuild' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was includ
ed, verify that the path is correct and try again.
At line:1 char:1
+ msbuild /property:GenerateFullPaths=true /t:build
+ ~~~~~~~
    + CategoryInfo          : ObjectNotFound: (msbuild:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

The terminal process terminated with exit code: 1
1

sciezka pewnie masz zle podana dla msbuild.
dodaj msbuild do PATH

0

Faktycznie teraz odpala budowanie projektu, choć chyba nie o to mi chodziło. W każdym razie znalazłem opis tutaj: Building your C++ application with Visual Studio Code
Dosyć skomplikowane wydaje się wywołanie kompilacji. Można jakoś ominąć tworzenie pliku build.bat’? Bo jak rozumiem, to taki plik, trzeba wrzucić do każdego utworzonego projektu?

0

poczytaj o makefile

0

Makefile jest mi znane. Ale czasami potrzebuję sprawdzić jakiś mały fragment kodu, czegoś spróbować itd. Pod Linuxem odpalam edytor, terminal, jedno polecenie z palca i mam aplikację zbudowaną. Pod Windowsem próbowałem z pakietem CYGWIN, ale działało to niemiłosiernie wolno ;-(. Jest teraz jeszcze opcja z linuxem w WIN10, ale to też się słabo sprawdziło.

1
If you want to build your application from VS Code, you will need to generate a tasks.json file:

Open the Command Palette (Ctrl+Shift+P).
Select the Tasks: Configure Tasks... command, click Create tasks.json file from templates, and you will see a list of task runner templates.
Select Others to create a task which runs an external command.
Change the command to the command line expression you use to build your application (for example g++).
Add any required args (for example -g to build for debugging).
You can also change the label to be more descriptive.
You should now see a tasks.json file in your workspace .vscode folder that looks something like:

{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "build hello world",
            "type": "shell",
            "command": "g++",
            "args": [
                "-g", "helloworld.cpp"
            ]
        }
    ]
}
If you'd like to be able to build your application with Tasks: Run Build Task (Ctrl+Shift+B), you can add it to the build group.

{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "build hello world",
            "type": "shell",
            "command": "g++",
            "args": [
                "-g", "helloworld.cpp"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            }
        }
    ]
}

For more information on tasks, see Integrate with External Tools via Tasks.

tak tylko sie da poprzez visual studio code

1 użytkowników online, w tym zalogowanych: 0, gości: 1