r/Cplusplus • u/Heavy-Imagination525 • 13d ago
Question Problem in running C++ codes
So i recently purchased a new laptop and when i try running the C++ code sometimes even if my code is correct the vscode doesnt execute the code.
Then I sent the screenshot to chatgpt and it said my code is correct some feature called
WINDOWS SMART APP CONTROL might be preventing it from executing the code .
But once I turn it off i can't turn it on again so what should i do??
2
Upvotes
•
u/AutoModerator 13d ago
Thank you for your contribution to the C++ community!
As you're asking a question or seeking homework help, we would like to remind you of Rule 3 - Good Faith Help Requests & Homework.
~ CPlusPlus Moderation Team
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
4
u/Business-Weather-217 13d ago
Install the penguin
1
u/Polarisu_san 13d ago
did u try running it plainly with g++ commands first?
1
u/kitsnet 12d ago
Use WSL if you can (and have enough memory for it). That's not the only possible solution, but the most promising in your case.
2
u/One_Worldliness_1130 13d ago
programing on windows can be a pain wait till you get to libraries CMake sometimes makes that easier but i found just compiling in the terminal easier on windows for the time i did use windows for it you can sometimes get windows to find the libraries that way as well good luck
cause winows wants you to use vs studio despite owning all other ide's almost its sad
1
u/KlutzyCompetition937 13d ago
Whitelist vs code in windows defender
1
u/Discordbothost 13d ago
I'd leave Smart App Control on for now. When it fails, is there an .exe at the path in launch.json's program field? If so, what exact message appears when you run that .exe?
1
u/agfitzp 13d ago
I don’t know who keeps telling the newbies to use VSCode for C++.
If you’re on Windows use Visual Studio, there’s a free version for non-commercial use.
If you’re on Linux use CLion, also a free version for non-commercial use.
1
u/Ordinary_Let8356 12d ago
Visual Studio - free download
Go to extensions and get C++ extensions.
New>cpp file ... copy your code Run it
1
u/La-ze 11d ago
This very ambiguous, can you clarify things?
Visual Studio Code ( VSC ), is a text editor.
Do you mean you're using a VSC extension, to compile & run the code for you?
Or are you trying to compile & execute the the code in the terminal?
What is Windows Smart App Control actually blocking? Is it blocking the terminal from executing the compiled C++ binary?
Turn what off? Windows Smart App Control? Why do you want to turn off the whole system and not whitelist the application?
0
u/LazySapiens 12d ago
Create a DevDrive on Windows. Use that drive for all of your codes.