cppcheck from command line not recognized - c++

I downloaded cppcheck to analyze my C++ programs, successfuly got to work it´s gui environment but I would also like to use it from command line.
In C:\users\me\documents\main.cpp
is my cpp program that I try to analyze with cppcheck. When I type cppcheck main.cpp in cmd, I only get a message saying 'cppcheck' is not recognized as an internal or external command,
operable program or batch file.
Is there anything I should link my cppcheck with in order to get recognized by command line?

The directory where cppcheck is installed needs to be added to your PATH if not present, or in alternative you have to give the full-pathname to the execution command.

Related

How to compile c++ in vs code?

Hi I'm a beginner at c++, I was trying to compile some code in vs code and I got this error: 'g++' is not recognized as an internal or external command,
operable program or batch file.
I'm just wondering how to fix this, whenever I try to compile in the command line I get a similar error?
First, you need to install a compiler(MinGW).
Now RightClick on My Computer
goto Advanced System Settings
Environment Variables
now there in system variable goto path
in that add the file location of MinGW\bin folder
save it and restart VScode

"g++" works in Command Prompt but not in VSCode Terminal

When I type "g++" in Windows Command Prompt, I get this message "g++: fatal error: no input files
compilation terminated.". However, when I try that in the VSCode terminal, I get this message instead "'g++' is not recognized as an internal or external command,
operable program or batch file.". Anyone know how to fix this?
Nevermind. I restarted my computer and that fixed the problem.

Error in running functions of C++ package at command line

I am new to packages in C++ and I am using Visual Studio to build the package. I have done that successfully but I can't run the functions of that package at the command line.
Error is
'graphgen' is not recognized as an internal or external command,
operable program or batch file.
I am following the instructions from this link
https://snap.stanford.edu/snap/install.html
where it says
After the code is compiled, as shown above, it can be executed. The graphgen application is used here as an example.
To run the graphgen example, open a command line application and execute the following command:
cd examples/graphgen
./graphgen -g:w -n:1000 -k:4 -p:0.1 -o:smallworld.txt
The command generates a Watts-Strogatz small-world graph where each node is connected to k=4 closest nodes and with the rewiring probability of p=0.1.
What to do?

django-shortcuts command prompt error 'C:\Program' is not recognized as an internal or external command, operable program or batch file

Trying to run "django r" command from a django shortcuts https://github.com/jgorset/django-shortcuts
Getting the error 'C:\Program' is not recognized as an internal or external command, operable program or batch file
Any ideas how to fix this?
Found some questions with the same error 'C:\Program' error. Not sure how it could help in my case.
Command Prompt Error 'C:\Program' is not recognized as an internal or external command, operable program or batch file
This answer is based about assumptions but I hope it helps you.
I thinks you have installed Python in a directory like C:\Programs Files on you computer. In django-shortcuts, python is called by using sys.executable directly in command line (here) and Windows call the first part until space as a executable.
You have different ways to solve this, including :
use '"%s"' % sys.executable
change %(python)s to "%(python)s"
reinstall Python in another directory without space in path ...

What needs to be done to get a distributable program from Eclipse?

I’ve produced a C++ program in Eclipse running on Redhat, which compiles and runs fine through Eclipse.
I thought that to run it separately to Eclipse you use the build artifact which is in the directory set via the project’s properties.
However this executable doesn’t run (I know it’s an executable as I’ve set it to be an executable via the project’s properties and it shows up as such via the ls command and the file explorer).
When attempting to run it using the executable’s name, I get the error:
bash: <filename>: command not found
When attempting to run it as a bash file:
<filename>: <filename>: cannot execute binary file
And when running it with "./" before the file name, nothing happens. Nothing new appears in the running processes and the terminal just goes to the next line as though I’d just pressed enter with no command.
Any help?
You've more or less figure out the first error yourself. when you just run <filename> , it is not in your PATH environment variable, so you get "command not found". You have to give a full or relative path when to the program in order to run it, even if you're in the same directory as the program - you run it with ./<filename>
When you do run your program, it appears to just exit as soon as you start it - we can't help much with that without knowing what the program does or see some code.
You can do some debugging, e.g. after the program just exits run echo $? to see if it exited with a particular exit value, or run your program using the strace tool to see what it does (or do it the usual way, insert printf debugging, or debug it with gdb)