2017-08-24 4 views
1

私はWSコードでVSコードを使い始めようとしています。私はg ++を使って端末でうまくコンパイルすることができますが、タスクを使ってこれを設定しようとすると、ソースファイルを見つけることができません。g ++タスクが単純なビルドのためのファイルを見つけることができません

ここでは、単純なhello world C++プログラムを試したときの出力を示します。私は単純なビルド・タスクとファイルが存在することを示すlsを表示しました。これらのタスクはどちらも、ソースコードファイルウィンドウに焦点を合わせながら実行されました。

Executing task: g++ helloworld.cpp < 
>g++: fatal error: no input files compilation terminated. 
>Terminal will be reused by tasks, press any key to close it. 

>Executing task: ls < 
>helloworld.cpp 
>Terminal will be reused by tasks, press any key to close it. 

私は基本的な誤解を持っているに違いないと思いますか?言うまでもなく、タスクによって作成されたターミナルを閉じてコマンドラインからビルドしようとすると、それはうまく動作します。

testvscpp$ ls 
helloworld.cpp 
testvscpp$ g++ helloworld.cpp 
testvscpp$ ls 
a.out helloworld.cpp 

助けてください。

EDIT:ビルドタスクは次のとおりです。 documentationで見つかったバージョンからわずかに異なっている

{ 
    // See https://go.microsoft.com/fwlink/?LinkId=733558 
    // for the documentation about the tasks.json format 
    "version": "2.0.0", 
    "tasks": [ 
     { 
      "taskName": "Simple build", 
      "type": "shell", 
      "command": "g++", 
      "args": [ 
       "helloworld.cpp" 
      ] 
     }, 
     { 
      "taskName": "Show ls", 
      "type": "shell", 
      "command": "ls" 
     } 
    ] 
} 

は - しかし、私もまさにこれを試し、それはどちらか動作しませんでした。 "args":の下

+1

!これは私のためには機能しません。実際には、私はVS Code Githubに投稿しましたが、この問題はまだWSLのサポートが不完全であることに関連していますが、回避策は ':'タスクの引数リストに追加します。 https://github.com/Microsoft/vscode/issues/33232 –

答えて

0

、引数-gが必要となります。

応答の欠如のために申し訳ありません
{ 
    // See https://go.microsoft.com/fwlink/?LinkId=733558 
    // for the documentation about the tasks.json format 
    "version": "2.0.0", 
    "tasks": [ 
     { 
      "taskName": "Simple build", 
      "type": "shell", 
      "command": "g++", 
      "args": [ 
       "-g", 
       "helloworld.cpp" 
      ] 
     }, 
     { 
      "taskName": "Show ls", 
      "type": "shell", 
      "command": "ls" 
     } 
    ] 
} 
関連する問題