vscodeのc_cpp_properties設定

vscodeのc_cpp_properties設定

 

C / C ++プラグインユーザーのプロジェクト構成

.vscode / c_cpp_properties.json次の行を追加します。

{
     "バージョン":4  "構成" :[ 
        {
             "名前": "MinGWの-W64-x86_64の"  "intelliSenseMode": "GCC-のx64"  "定義"  "デバッグ"  "_DEBUG" 「_DEBUG_CDB " "UNICODE"  "_UNICODE"  "_FORTIFY_SOURCE = 1"  "CHECK_PTHREAD_RETURN_VALUE"  "_FILE_OFFSET_BITS = 64"  "_LARGEFILE64_SOURCE" "LARGEFILE_SOURCE"  "__cdecl = __属性__((__ cdecl__))" 
            ]、
             "インクルードパス" :[
                 "$ {workspaceRoot} \\\\ SRC"  "$ {workspaceRoot} \\\\ INC" 「C:\\ \\ msys64 \\\\にMinGW64 \\\\ "などが " C:\\\\ msys64 \\\\にMinGW64 \\\\含ま\\\\ C ++ \\\\ 9.2.0 \\\\後方を" "C:\\\\ msys64 \\\\にMinGW64 \\\\含ま\\\\ C ++ \\\\ 9.2.0"  " C:\\\\ msys64 \\\\にMinGW64 \\\ \ x86_64の-W64-MINGW32 \\\\含ま" " C:\\\\ msys64 \\\\にMinGW64 \\\\ libに\\\\ GCC \\\\ x86_64の-W64-MINGW32 \\\\ 9.2.0 \\\\含ま-固定」 "C:\\\\ msys64 \\\\にMinGW64 \\\\ libに\\\\ GCC \\\\ x86_64の-W64-MINGW32 \\\\含ま\\\\ 9.2.0" 
            ]、
             "ブラウズ"を:{
                 "パス"  "$ {workspaceRoot} \\\\ SRC"  "$ {workspaceRoot} \\\\ INC"  "C:\\\\ msys64 \\\\にMinGW64 \\\\含みます"  "C:\\\\ msys64 \\\\にMinGW64 \\\\含ま\\\\ C ++ \\\\ 9.2.0 \\\\後方" 「C:\\\\ msys64 \\\\ MinGW64 \\\\ \\\\ C ++ \\\\ 9.2.0"には "C:\\\\ msys64 \\\\にMinGW64 \\\\ x86_64の-W64-MINGW32は\\\\"が含まを"C:\\\\ msys64 \\\\にMinGW64 \\\\ LIB \\\\ GCC \\\\固定挙げ\\\\ x86_64の-W64-MINGW32 \\\\ 9.2.0" 「C :\\\\ msys64 \\\\にMinGW64 \\\\ libに\\\\ GCC \\\\ x86_64の-W64-MINGW32 \\\\含ま\\\\ 9.2.0」
                ]、
                 "limitSymbolsToIncludedHeaders": "databaseFilename": "" 
            }、
             "windowsSdkVersion": "10.0.17134.0"  "compilerPath": "C:\\\\ msys64 \\\\にMinGW64 \\\\ビン\\\\ G ++ EXE"  "cStandard": "C11"  "cppStandard": "C ++ 17" 
        } 
    ] 
}

 

-----------------------------------

.vscode / launch.json次の行を追加します。

{
     "バージョン": "0.2.0"  "構成" :[ 
        {
             "名前": "C ++起動(GDB)"  "タイプ": "cppdbg"  "リクエスト": "起動"  "プログラム": " $ {fileDirname} \\ $ {} fileBasenameNoExtension .EXE」 "引数" :[]、
             "stopAtEntry": "CWD": "$ {workspaceFolder}"  "環境" :[]、
             "externalConsole":"MIMode": "GDB" "miDebuggerPath": "C:\\ msys64 \\にMinGW64 \\ビン\\ gdb.exe"  "setupCommands" :[ 
                {
                     "説明": "GDBのためにかなり印字有効"  "テキスト":「-enable-プリティ印刷」 "ignoreFailures":
                } 
            ]、
             "preLaunchTask": "CppCompile" 
        } 
    ] 
}

 

.vscode / tasks.json次の行を追加します。

{
     "バージョン": "2.0.0"  "タスク" :[ 
        {
             "タイプ": "シェル"  "ラベル": "CppCompile"  "コマンド":「C:\\ msys64 \\にMinGW64 \\ binに\ 。\ G ++ EXE」 "引数" :[
                 "-g"  "-Og"  "-Wall"  "-static-のlibgcc"  "-std = C ++ 17"  "$ {ファイル}"  "-o" "$ {fileDirname} \\ $ {fileBasenameNoExtension} .EXE" 
            ]、
             "オプション":{
                 "CWD": "C:\\ msys64 \\にMinGW64 \\ビン" 
            }、
             "グループ" :{
                 "種類": "ビルド"  "のIsDefault":
            }、
             "プレゼンテーション" :{
                 "エコー"。 "明らかに": "常に"  "焦点": "パネル": "共有"  "showReuseMessage": "クリア":
            }、
             "problemMatcher": "$ gccの" 
        } 
    ] 
}

 

------------------------------------

コード・ランナーのユーザーグローバルコンフィギュレーションウィジェット

C:\ Users \ユーザーLSGX \のAppData \ローミング\コード\ユーザー\以下を追加しますsettings.json:

    "コード・runner.runInTerminal":真
    "コード・runner.ignoreSelection":真
    "コード・runner.executorMap" :{ 
        "C":「CD $ DIR &&のgcc $ fileNameに-o $ fileNameWithoutExt.exe -Wall -グラム-Og -static-libgccの-std = c11の&& $ DIR $ fileNameWithoutExt.exe "  "CPP":" CD $ DIR && G ++ $ fileNameに-o $ fileNameWithoutExt.exe -Wall -g -Og -static-libgccの-std = C ++ 17 && $ DIR $ fileNameWithoutExt.exe」 }

 

----------------------------------------

C ++コンパイラをサポートファクトシート  https://zh.cppreference.com/w/cpp/compiler_support  

 

--------------------------------------

ビューgccの構成情報のエコー| gccの-v -xc -E -
G ++コンフィギュレーション情報のエコーを見る| gccの-v -x C ++ -E -
G ++コンフィギュレーション情報のエコーを見る| G ++ -v -x C ++ -E -

 

--------------------------

注:プログラムのエントリがwWinMain WinMain関数に変更する必要があるようMINGW32はwWinMainをサポートしていません。

C:/ msys64 /にMinGW64 / binに/../ libに/ GCC / x86_64の-W64-MINGW32 / 9.2.0 /../../../../ x86_64の-W64-MINGW32 / binに/ ld.exe:関数`主に:C:/msys64/mingw64/x86_64-w64-mingw32/lib//libmingw32.a(lib64_libmingw32_a-crt0_c.o)
E:/ mingwbuild / mingwの-W64-CRT-gitの/ SRC / mingw- W64 / mingwの-W64-CRT / CRT / crt0_c.c:18:WinMain関数`の未定義参照
collect2.exe:エラー:ldは1つの終了ステータスが返さ

 

経由  https://stackoverflow.com/questions/58324230/undefined-reference-to-winmain-c-mingw

One thing to note is that Visual C++ supports a “wWinMain” entry point where the “lpCmdLine” parameter is a “LPWSTR”. You would typically use the “_tWinMain” preprocessor definition for your entry point and declare “LPTSTR lpCmdLine” so that you can easily support both ANSI and Unicode builds. However, the MinGW CRT startup library does not support wWinMain, so you’ll have to stick with the standard “WinMain” and use “GetCommandLine()” if you need to access command line arguments.

Use WinMain instead. This program doesn't use pCmdLine value, so it should compile when you change wWinMain to WinMain and PWSTR pCmdLine to PSTR pCmdLine.

 

via https://docs.microsoft.com/en-us/windows/win32/learnwin32/prepare-your-development-environment
via https://www.transmissionzero.co.uk/computing/win32-apps-with-mingw/

 

================ End

 

おすすめ

転載: www.cnblogs.com/lsgxeva/p/12122271.html