c++commandcommand-prompt Show I am very new to c++ and using the command prompt. I have multiple .cpp and .h files that run fine on my IDE (Code::blocks) running GNU GCC as the compiler. It displays what I need it too but when I try to use the command prompt and type "g++ file1.cpp file2.cpp …." then "./a.out I get the error "'.' is not recognized as an internal or external command, operable program or batch file." what have I messed up? Best SolutionIn command-prompt you just add executable filename (e.g. out.exe) In powershell run the executable file like .\out.exe. The command : g++ -c [source file].cpp produces object file [source file].oAnd The command : g++ -o [executable file] [object file].o produces object file [executable]For example Compiling "hello.cpp" into executable "hello.exe" in one step and running it : Z:\cpp> g++ -o hello.exe hello.cpp Z:\cpp> hello.exe Create the exe file using object files : Z:\cpp> g++ -c file1.cpp Z:\cpp> g++ -c file2.cpp Z:\cpp> g++ -o out.exe file1.o file1.o Z:\cpp> out.exe I am trying to set up the VScode with C++ Compiler and the problem I got is (By running the code with code runner)
and if I run with the debug option I got this problem
This is my "c_cpp_properties.json" { "configurations": [ { "name": "Win32", "intelliSenseMode": "clang-x64", "defines": [ "_DEBUG", "UNICODE", "__GNUC__=7", "__stdcall=attribute((stdcall))", "__cdecl=__attribute__((__cdecl__))", "__cplusplus=201703L" ], "includePath": [ "${workspaceFolder}/include", "C:/MinGW64/bin/../lib/gcc/x86_64-w64-mingw32/4.9.2/include/c++", "C:/MinGW64/bin/../lib/gcc/x86_64-w64-mingw32/4.9.2/include/c++/x86_64-w64-mingw32", "C:/MinGW64/bin/../lib/gcc/x86_64-w64-mingw32/4.9.2/include/c++/backward", "C:/MinGW64/bin/../lib/gcc/x86_64-w64-mingw32/4.9.2/include", "C:/MinGW64/bin/../lib/gcc/x86_64-w64-mingw32/4.9.2/../../../../include", "C:/MinGW64/bin/../lib/gcc/x86_64-w64-mingw32/4.9.2/include-fixed", "C:/MinGW64/bin/../lib/gcc/x86_64-w64-mingw32/4.9.2/../../../../x86_64-w64-mingw32/include" ], "browse": { "path": [ "${workspaceFolder}/include", "C:/MinGW64/bin/../lib/gcc/x86_64-w64-mingw32/4.9.2/include/c++", "C:/MinGW64/bin/../lib/gcc/x86_64-w64-mingw32/4.9.2/include/c++/x86_64-w64-mingw32", "C:/MinGW64/bin/../lib/gcc/x86_64-w64-mingw32/4.9.2/include/c++/backward", "C:/MinGW64/bin/../lib/gcc/x86_64-w64-mingw32/4.9.2/include", "C:/MinGW64/bin/../lib/gcc/x86_64-w64-mingw32/4.9.2/../../../../include", "C:/MinGW64/bin/../lib/gcc/x86_64-w64-mingw32/4.9.2/include-fixed", "C:/MinGW64/bin/../lib/gcc/x86_64-w64-mingw32/4.9.2/../../../../x86_64-w64-mingw32/include" ], "limitSymbolsToIncludedHeaders": false, "databaseFilename": "" }, "cStandard": "c11", "cppStandard": "c++17" } ], "version": 4} This is my "launch.json" { "version": "0.2.0", "configurations": [ { "name": "Run C/C++", "type": "cppdbg", "request": "launch", "program": "${workspaceFolder}/${fileBasenameNoExtension}.exe", "args": [], "stopAtEntry": false, "cwd": "${workspaceFolder}", "environment": [], "externalConsole": true, "MIMode": "gdb", "miDebuggerPath": "C:/MinGW64/bin/gdb.exe", "setupCommands": [ { "description": "Enable pretty-printing for gdb", "text": "-enable-pretty-printing", "ignoreFailures": false } ], "preLaunchTask": "build & run file" }, { "name": "Debug C/C++", "type": "cppdbg", "request": "launch", "program": "${workspaceFolder}/${fileBasenameNoExtension}.exe", "args": [], "stopAtEntry": false, "cwd": "${workspaceFolder}", "environment": [], "externalConsole": true, "MIMode": "gdb", "miDebuggerPath": "C:/MinGW64/bin/gdb.exe", "setupCommands": [ { "description": "Enable pretty-printing for gdb", "text": "-enable-pretty-printing", "ignoreFailures": false } ], "preLaunchTask": "build & debug file" } ] }And this is my "tasks.json" { "version": "2.0.0", "tasks": [ { "label": "build & debug file", "type": "shell", "command": "g++", "args": [ "-g", "-o", "${fileBasenameNoExtension}", "${file}" ], "group": { "kind": "build", "isDefault": true } }, { "label": "build & run file", "type": "shell", "command": "g++", "args": [ "-o", "${fileBasenameNoExtension}", "${file}" ], "group": { "kind": "build", "isDefault": true } } ] }I just want to study C++ and I try a lot of way on the Internet for days and I still can't fix it Please help. How do you fix G ++' is not recognized as an internal or external command operable program or batch file?After downloading, install MinGW and wait for the “MinGW Installation Manager” to show up.. When the “MinGW Installation Manager” shows up, click on mingw32-gcc-g++ then select “Mark for Installation”. In the menu at the top left corner, click on “Installation > Apply Changes”. Wait and allow to install completely.. How do I fix G + is not recognized as an internal?You need to set the environment PATH to include the directory of mingw's bin directory if you want o use gcc.exe or g++.exe in cmd . run 'path' or 'echo %PATH% in cmd.exe prompt.
How do you fix next is not recognized as an internal or external command?About the Unrecognized Command
npm run dev > dev > next dev 'next' is not recognized as an internal or external command, operable program or batch file. Good news, the solution is actually just to install the Next. js npm package.
Why G ++ is not recognized Vscode?If you don't see the expected output or g++ or gdb is not a recognized command, make sure your PATH entry matches the Mingw-w64 binary location where the compilers are located. If the compilers do not exist at that PATH entry, make sure you followed the instructions on the MSYS2 website to install Mingw-w64.
|