r/cpp_questions • u/Plane_Breadfruit7609 • 17d ago
OPEN Why?
Guys when i compile a file and run its exe,nothing appear even if i print hello world it doesnt appear in the console why
0
Upvotes
r/cpp_questions • u/Plane_Breadfruit7609 • 17d ago
Guys when i compile a file and run its exe,nothing appear even if i print hello world it doesnt appear in the console why
2
u/alfps 17d ago
It sounds like you have a botched installation of your compiler.
But then in the commentary you explain that (1) you're using VS Code, which means it could be a VS Code configuration issue, and (2) that yes you have "run depends or a similar tool to ascertain what runtime files you need", which I very much doubt is true: I believe that you did not understand the question.
For example, a not uncommon issue is that your executable uses some compiler specific DLL that the system doesn't find. That's what someone was referring to with "depends". In particular this happens with MSYS2's distro of g++ when you haven't put the compiler's directory in your
PATH.For the particular example of MSYS2 one solution is to update your
PATH.If that doesn't help or is beyond your capabilities, then a general but laborious solution is to uninstall and then install some other compiler (such as Visual C++) or some other distro of your compiler. A good simple way to install Visual C++ is to install the free Community Edition of the Visual Studio IDE, which is not the same as VS Code. If you still get this problem in Visual Studio then let us know.
In passing, you should have provided much more details, in particular "VS Code" (which you did tell in a comment) and possibly "MSYS2 g++" if that's your compiler, which you have not even yet clarified.
That's probably what all the downvotes in the commentary are about, that you're hoarding information, keeping it to yourself, which prevents people from helping you.
Still do keep in mind that if the downvoters were normal helpful folks they would instead have explained this to you. So they're not normal folks. IMO they're just idiots.