#when i try to run cpp program hello world it is not displaying in the console can anybody help me
58 messages ยท Page 1 of 1 (latest)
When your question is answered use !solved or the button below to mark the question as resolved.
Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.
@dry leaf
Your message appears to contain screenshots but no code. Please send code and error messages in text instead of screenshots if applicable!
Try typing g++ Untitled-1.cpp -o Untitled-1 -static ; .\Untitled-1 in the terminal
Does that work?
yes i tried i sitll get same error
there's an error?
Alright
like this is the most annoying part i am trying to learn cpp i am new to cpp
Type echo $env:PATH and show the result
Honestly using Visual Studio/CLion/Rider would save you all of this headache
oh so i should stop vscode then
There's minimal headache
See C:\msys64\ucrt64\bin right in the middle? It should be as close to the beginning as possible. Move it there as described here: https://github.com/HolyBlackCat/cpp-tutorials/blob/master/tooling/articles/terminal_for_dummies.md#how-to-modify-path
I would advise that. All three of those IDEs I mentioned are completely free for noncommercial use, and they require minimal setup to get working
sorry i did not get you
Didn't get what part? ๐
i mean See C:\msys64\ucrt64\bin right in the middle? It should be as close to the beginning as possible. Move it there as described here:
dir Untitled-1.*
what does this output ?
how does it help in mvoing the path file
You have to edit the path setting as described in the link
Read the link, it explains what to do
this is the path
right so something went wrong in compilation
run just
g++ Untitled-1.cpp -o untitled
and show what it shows
i get nothing
now run ./untitled
Ok, so move C:\msys64\ucrt64\bin to the very beginning of this list.
Save the changes, restart vsc, type echo $env:PATH again, and hopefully it should be closer to the beginning of the list
Ok sure
@hot sluice dont u think this is weird ? even if it did choose the wrong g++ , shouldnt it atleast make a exe ?
Yeah this is GCC-on-windows weirdness. It has some internal executables that are in a different directory (so not in the same directory as the DLLs they need), which can make it sensitive to bad PATH
hmmm , interesting
On Linux this is not a problem because executables hardcode library search paths. While on Windows they normally only search in their own directory and in PATH (and some other places)
So did it work?
i have moved up and restared my vsc
yes it did work
but how does moving C:\msys64\ucrt64\bin this to top work not at bottom i am super confused
like the order does not matter right
It does matter ๐
It's somewhat convoluted too, and it can affect your own programs, not just the compiler. https://stackoverflow.com/q/78598336/2752075
oh i am new to cpp can you guide me what topics i need to learn
and where to practice cpp
i am currently watching videos from cherno
thank you so much for helping me resolving this issue
You're welcome ๐
I don't have a list of topics for you.
People usually recommend text tutorials or books, instead of videos, since they're usually more accurate. But that's up to you
If you decide to go with a book, I heard Stroustrup's PPP is alright
but the maain problem with books is get i get pretty bored and sleep quickly i am more of visual learner but i need to practise cpp real world project
Certain approaches to learning make you sleepy. Like if you stop understanding what's going on (because the author used some terms you don't know or whatever), but you try to continue reading anyway without figuring it out, that sometimes happens ๐
But anyway, if videos work ok for you, continue with videos I guess?
ok sure but if i don't understadning i can raise my doubts hear right
Ofc
thanks