'make' command is not working within terminal VScode - c++

I feel like this is a very trivial question, I cannot figure out for the life of me what is going on with my VScode.
that the path is correct and try again.
At line:1 char:1
+ make
+ ~~~~
+ CategoryInfo : ObjectNotFound: (make:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Suggestion [3,General]: The command make was not found, but does exist in the current location. Windows PowerShell does not load commands from the current location by default. If you trust this command, instead type: ".\make". See "get-help about_Command_Precedence" for more details.
I am just trying to compile two files together to make them work. They compile and execute seperately, but when I use the 'make' command, in the terminal within VS, it delivers this error.
I believe that my makefile is setup correctly, literally following my professors video on how to do it and it's working properly.
Any pointers??

As the message says: Make command is not found!
Make sure your make command does exist by simply typing make and hitting enter.
if it does not exist install both: build-essentials and make using pip/conda/npm/npx
These are the main rules to make the target work!

Related

Cannot run .exe file from VS Code Terminal / Powershell

In my folder are these files:
hello.cpp hello.exe hello.ilk hello.pdb
When I try to execute the .exe file within a terminal in VS Code I receive this:
C:\Users\User\Documents\VS_Code> hello.exe
hello.exe : The term 'hello.exe' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the
path is correct and try again.
At line:1 char:1
+ hello.exe
+ ~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (hello.exe:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Suggestion [3,General]: The command hello.exe was not found, but does exist in the current location. Windows PowerShell does not load commands from the current location by default. If you trust this command, instead type: ".\hello.exe". See "get-help about_Command_Precedence" for more details.
When I'm running it from the developer prompter from Visual Studio it works.
I think your issue can be solved by just looking at the error suggestion. It says to use .\hello.exe .
Hope this helps :)

Determine whether programs run on Powershell or CMD

I created a program that should rename some files
system("rename file.txt file2.txt"); // examples only
did run fine at cmd , but not powershell
rename : The term 'rename' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ rename
+ ~~~~~~
+ CategoryInfo : ObjectNotFound: (rename:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
by This article from MS , powershell should use rename-itemHowever , I don't know any "trick" to determine whther programs ran by powershell or cmdA post for determine program's run by which , uses process checking which I find it hard to implement ( they said use wmic.exe , but I don't know how to and further research needed to be )
The conclusion:
How to determine whether my programs runs on powershell or cmd by C++ ?
Is it possible, by knowing the console used ( programmingly ) , my programs could use if-else method to change the command?
Edit: for the time being , My program's method is read file.txt and paste it in file2.txt ( examples only )..Basically like copy and paste to another renamed file and use system("del file.txt");
How to determine whether my programs runs on powershell or cmd by C++
While that is possible, it also irrelevant to your use case, because the shell that launched your program is your program's parent process (to which you cannot submit commands).
Since your program must launch its own shell (child) process in order to execute a shell command, you're free to choose which shell to invoke .
The system() C library function targets the host platform's default shell, which is cmd.exe on Windows (and /bin/sh on Unix-like platforms), so your command - which uses the internal cmd.exe rename command - will work fine, irrespective of whether your program was invoked from PowerShell or cmd.exe.

Problems running program

I'm learning C++ for the first time (im using microsoft visual studio code) and i'm trying to run my code based on the video im watching. I have exactly what he has in the video but i have an error;
PS C:\Users\Baseb> g++ cpplearning.cpp
g++ : The term 'g++' is not recognized as the name of a cmdlet, function, script file,
or operable program. Check the spelling of the name, or if a path was included, verify
At line:1 char:1
g++ cpplearning.cpp
+ CategoryInfo : ObjectNotFound: (g++:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException .
I have downloaded minGW and the path i was using is; C:\MinGW\bin . Do you know why I am getting this error code? I typed G++ --version and it shows I do have G++ installed on my computer.
Thank You
If you run g++ from a terminal and it is a Windows terminal (cmd or other), you have to include the g++ binary path in the Windows PATH environment variable.
If you run the compiler from VS then follow the link from #Eljay comment.

InstallShield creates MSI even though build has errors

When I'm compiling ism project to create MSI, its still creates the MSI even though I have build errors.
The reason I need it NOT to be created is for build verification.
Instead of checking the build log for errors, I will just check the existence of the MSI.
Does anybody know how can I achieve that?
EDIT:
I'm using ISCmdBld tool to build MSIs. This is the command line I'm running to build where the environment variables are being set before running this command:
IsCmdBld -p "%FULL_PROJECT_FILENAME%" -a %BUILDMODE% -r %PRODUCT% -o "%MMSEARCHPATH%" | tee /A "%FULL_PROJECT_LOG_FILENAME%"
If you are compiling using IsCmdBld.exe, you should add the -x option, so that the build is stopped if an error occurs.
You also can use it combined with -w, which makes each warning becomes considered as an error (and thus, each warning encountered also stops the build).
More information about IsCmdBld.exe : http://helpnet.installshield.com/installshield16helplib/ISCmdBldParam.htm
I hope this helps.
Your build automation should check the exit code from ISCmdBld.exe. If the exit code is a failure, don't archive the output.

Apache Ant Build command "Access Denied"

Hey! I am trying to get ant installed and actually already did following this instructions however, I get this error:
Buildfile: build.xml does not exist!
Build failed
which it says there I might get so I just tried executing the next command it says I should(since I'm under Windows it's this one):
build -Ddist.dir=<C:\Ant> dist
anyway I get "access denied" when hitting enter and I can't figure out why. I also tried
build install
and
build install-lite
but I always get that message =/ any ideas why? or what am I doing wrong?
Edit
Without the < > I get a:
'build' is not recognized as an
internal or external command, operable
program or batch file.
Edit2
Well, my ANT_HOME is in C:\Ant and I'm trying to run the command while placing myself on that folder, isn't that correct?
Ant is already installed correctly if you're getting this:
Buildfile: build.xml does not exist!
Build failed
The "build" commands you tried next are only for building Ant from source. You don't need to do this, since Ant is already installed.
In general, the "'XXXX' is not recognized..." means XXXX is not a command/executable, or that it's not on your PATH.
You are taking the < and > symbols too literally. Take them off.
Kind of like C:\Users\<Your ID> the symbols are placeholders.
Are you in the right directory? Do you have something else called build in your path that may be superceeding the build you are trying to call. Can you create a file in that directory?
PROMPT> copy con foo.txt
asdf
asdf
sdf
CONTROL-D
Not sure if this helps but the first question that comes to mind is "do you have appropriate permissions on the file"?