2016-11-29 18 views
1

私はopencv3をbrewでインストールしました。私は何度もpkg-configを設定しようとしましたが、コンパイルに成功できませんでした。私はインターネットで方法を捜したが、私は見つけることができなかった。Visual StudioコードでOpencvをコンパイルするには?

タスクは以下の通りです:

{ 
    // See https://go.microsoft.com/fwlink/?LinkId=733558 
    // for the documentation about the tasks.json format 
    "version": "0.1.0", 
    "command": "g++", 
    "isShellCommand": true, 
    "showOutput": "always", 
    "suppressTaskName": true, 
    "tasks": [ 
     { 
      "taskName": "build", 
      "isBuildCommand": true, 
      "args": [ 
       `pkg-config --libs opencv --cflags opencv`, 
       "-o", 
       "vsc", 
       "${workspaceRoot}/main.cpp", 
       "-g" // Debug 
      ], 
      "showOutput": "always" 
     } 
    ] 
} 

pkg-configは、以下のようなものです:

のpkg-configが

$ pkg-config --libs opencv 
-L/usr/local/Cellar/opencv3/3.1.0_3/lib -lopencv_shape -lopencv_stitching -lopencv_objdetect -lopencv_superres -lopencv_videostab -lippicv -lopencv_calib3d -lopencv_features2d -lopencv_highgui -lopencv_videoio -lopencv_imgcodecs -lopencv_video -lopencv_photo -lopencv_ml -lopencv_imgproc -lopencv_flann -lopencv_core 

のpkg-config設定の--cflags

を--libs
$ pkg-config --cflags opencv 
-I/usr/local/Cellar/opencv3/3.1.0_3/include/opencv -I/usr/local/Cellar/opencv3/3.1.0_3/include 

あなたはVisual Studioコードでopencvをコンパイルする方法を知っていますか?

答えて

0

OS:Ubuntuの16.04、OpenCVのバージョン:3.2.0 、プログラムのファイル名:videocapture_starter.cpp、および出力ファイル名:

videocapture_starter Iを構築するには、以下のtask.jsonファイル

を使用"0.2.0"、 "構成":私は、次のlaunch.jsonファイル 「{ "バージョン" を使用したプログラムをデバッグする{ // See https://go.microsoft.com/fwlink/?LinkId=733558 // for the documentation about the tasks.json format "version": "0.1.0", "command": "g++", "isShellCommand": true, "showOutput": "always", "args": ["-g", "videocapture_starter.cpp", "-o", "videocapture_starter", "-I/usr/local/include/opencv", "-I/usr/local/include","-I/usr/include", "-L/usr/local/lib", "-lopencv_shape", "-lopencv_stitching", "-lopencv_objdetect", "-lopencv_superres", "-lopencv_videostab", "-lopencv_calib3d", "-lopencv_features2d", "-lopencv_highgui", "-lopencv_videoio", "-lopencv_imgcodecs", "-lopencv_video", "-lopencv_photo", "-lopencv_ml", "-lopencv_imgproc", "-lopencv_flann", "-lopencv_core"] }

: [

{ 
    "name": "C++ Launch", 
    "type": "cppdbg", 
    "request": "launch", 
    "program": "${workspaceRoot}/videocapture_starter", 
    "args": ["0"], 
    "stopAtEntry": false, 
    "cwd": "${workspaceRoot}", 
    "environment": [], 
    "externalConsole": true, 
    "linux": { 
    "MIMode": "gdb", 
    "includePath": ["/usr/include", "/usr/local/include/opencv", "/usr/local/include"], 
    "setupCommands": [ 
     { 
     "description": "Enable pretty-printing for gdb", 
     "text": "-enable-pretty-printing", 
     "ignoreFailures": true 
     }] 
    } 
}, 
{ 
    "name": "C++ Attach", 
    "type": "cppdbg", 
    "request": "attach", 
    "program": "${workspaceRoot}/a.out", 
    "processId": "${command:pickProcess}", 
    "linux": { 
    "MIMode": "gdb", 
    "setupCommands": [ 
     { 
     "description": "Enable pretty-printing for gdb", 
     "text": "-enable-pretty-printing", 
     "ignoreFailures": true 
     }] 
    }}]}' 
+0

showOutputは非推奨です。それはあなたに "プレゼンテーション"を使用するように要求し、内部の "公開"は "常に"に設定する必要があります。 – Antoni

関連する問題