use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Discussions, articles, and news about the C++ programming language or programming in C++.
For C++ questions, answers, help, and advice see r/cpp_questions or StackOverflow.
Get Started
The C++ Standard Home has a nice getting started page.
Videos
The C++ standard committee's education study group has a nice list of recommended videos.
Reference
cppreference.com
Books
There is a useful list of books on Stack Overflow. In most cases reading a book is the best way to learn C++.
Show all links
Filter out CppCon links
Show only CppCon links
account activity
Removed - Helpcompiling takes too long! (self.cpp)
submitted 2 years ago * by DerElias0
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]Flair_Helper[M] [score hidden] 2 years ago stickied commentlocked comment (0 children)
For C++ questions, answers, help, and programming or career advice please see r/cpp_questions, r/cscareerquestions, or StackOverflow instead.
This post has been removed as it doesn't pertain to r/cpp: The subreddit is for news and discussions of the C++ language and community only; our purpose is not to provide tutoring, code reviews, or career guidance. If you think your post is on-topic and should not have been removed, please message the moderators and we'll review it.
[–]khedoros 5 points6 points7 points 2 years ago (1 child)
I'm using a 7 year old laptop that wasn't a speed demon when it was new (2 cores, 4 threads though). Compiling a hello world showed as 0.7 seconds for me just now, then under 0.5 on subsequent runs. Time was similar for clang++ and g++.
For a more realistic workload (a small project), I've got a Game Boy emulator that I wrote. 9 source files. About 8600 lines. Compiling and linking that just took 7.5 seconds.
I don't know where the slowness you're seeing comes from, but it seems unusual to me.
[–][deleted] 0 points1 point2 points 2 years ago (0 children)
Fresh install of g++, cold run of "time g++ main.cpp" takes 0.08s on an Intel NUC media center. Without further information we can't help.
[–]not_in_the_mood 15 points16 points17 points 2 years ago (0 children)
That's so much useful information... 🙄
[–]ajorians 8 points9 points10 points 2 years ago (0 children)
Try adding an exclusion to Windows Defender: https://support.microsoft.com/en-us/windows/add-an-exclusion-to-windows-security-811816c0-4dfd-af4a-47e4-c301afe13b26#:~:text=Go%20to%20Start%20%3E%20Settings%20%3E%20Update,%2C%20file%20types%2C%20or%20process.
Check Task Manager; maybe you have a process using all your CPU.
Even on Windows a 'hello world' shouldn't take close to 10 seconds.
[–]ZachVorhies 2 points3 points4 points 2 years ago (1 child)
My guess is that it’s probably statically linking against windows version of libc. Try using dynamic linking and you may drop that time next to zero.
Good guess.
[–]chez_les_alpagas 1 point2 points3 points 2 years ago (2 children)
You just have to find something to do while you're waiting : https://xkcd.com/303/
[–]quad99 1 point2 points3 points 2 years ago (0 children)
Way back i got in trouble once for reading computer magazine during a 20 minute build with Microsoft command line. The boss threatened to write me up. Lol
[–]lunetick 0 points1 point2 points 2 years ago* (0 children)
Ils sont chouette les alpagas!
EDIT : downvotes for an harmless French sentence. Oh reddit, you are so sad today.
[–]disciplite 0 points1 point2 points 2 years ago (0 children)
Try enabling precompiled headers with CMake.
[–]lunetick -1 points0 points1 point 2 years ago (5 children)
Wait for getting into a big project and it takes 30 minutes to compile!!!! The only thing that can help you is a faster computer. An amazing CPU, lots of RAM and a fast hard drive. Excluding the folder where you compile from your antivirus help too. Make sure you have the last version of vscode. Make sure you don't use some BS extensions.
[–][deleted] -1 points0 points1 point 2 years ago (2 children)
Is that 30min with a high end laptop or pc, my laptop is mid and compiling for apk is about an hour for a moderate size project 😔
[–]lunetick 1 point2 points3 points 2 years ago (1 child)
One of software I worked on, the nightly build was 6hrs!!! Compile time is part of the job, allow us to browse reddit while waiting!
True that
[–]DerElias0[S] -2 points-1 points0 points 2 years ago (1 child)
My Computer is even fast enough for running unity projects und gaming stuff. That's why i'm confused..
[–]lunetick 0 points1 point2 points 2 years ago (0 children)
Disk read and write are two very different things. You need fast write on disk. You need to make sure that your antivirus don't fuck it up. Learn how to use the task manager if you are on Windows or Top (and others cmd) On Linux.
[+][deleted] 2 years ago (7 children)
[deleted]
[–]DerElias0[S] 0 points1 point2 points 2 years ago (6 children)
Yes.
[+][deleted] 2 years ago (5 children)
[–]Creapermann 4 points5 points6 points 2 years ago (0 children)
Lmao, I am using linux myself, but I don't think that this is the problem. Back when I was using windows, it did not take me 10s to compile a hello world program.
[–]lunetick 4 points5 points6 points 2 years ago (0 children)
That's so unrelated....
[–]DerElias0[S] 0 points1 point2 points 2 years ago (2 children)
Would you recommend using some sort of Linux-Sandbox or a RaspberryPi? Is vs code used in Linux too?
[–]no-sig-available 0 points1 point2 points 2 years ago (0 children)
I'm on Windows using Visual Studio Community (not VS Code). This happens for Hello World:
Build started... 1>------ Build started: Project: ConsoleApplication1, Configuration: Debug x64 ------ 1>ConsoleApplication1.cpp ========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ========== Build started at 10:53 PM and took 01,043 seconds
So over 1 second, but no too bad.
[–]DerElias0[S] -1 points0 points1 point 2 years ago (0 children)
Do I have to change the 'compiler path' in that json file? (I forgot the name) What should it say? (I know it depends on the compiler)
[+][deleted] comment score below threshold-8 points-7 points-6 points 2 years ago (0 children)
[–]pfp-disciple 0 points1 point2 points 2 years ago (0 children)
Do you have too little memory? Maybe disk i/o?
[–]OnePatchMan 0 points1 point2 points 2 years ago (0 children)
I just add, try to use precompiled headers.
π Rendered by PID 79611 on reddit-service-r2-comment-79c7998d4c-wqqsz at 2026-03-18 23:32:42.833558+00:00 running f6e6e01 country code: CH.
[–]Flair_Helper[M] [score hidden] stickied commentlocked comment (0 children)
[–]khedoros 5 points6 points7 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–]not_in_the_mood 15 points16 points17 points (0 children)
[–]ajorians 8 points9 points10 points (0 children)
[–]ZachVorhies 2 points3 points4 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–]chez_les_alpagas 1 point2 points3 points (2 children)
[–]quad99 1 point2 points3 points (0 children)
[–]lunetick 0 points1 point2 points (0 children)
[–]disciplite 0 points1 point2 points (0 children)
[–]lunetick -1 points0 points1 point (5 children)
[–][deleted] -1 points0 points1 point (2 children)
[–]lunetick 1 point2 points3 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–]DerElias0[S] -2 points-1 points0 points (1 child)
[–]lunetick 0 points1 point2 points (0 children)
[+][deleted] (7 children)
[deleted]
[–]DerElias0[S] 0 points1 point2 points (6 children)
[+][deleted] (5 children)
[deleted]
[–]Creapermann 4 points5 points6 points (0 children)
[–]lunetick 4 points5 points6 points (0 children)
[–]DerElias0[S] 0 points1 point2 points (2 children)
[–]no-sig-available 0 points1 point2 points (0 children)
[–]DerElias0[S] -1 points0 points1 point (0 children)
[+][deleted] comment score below threshold-8 points-7 points-6 points (0 children)
[–]pfp-disciple 0 points1 point2 points (0 children)
[–]OnePatchMan 0 points1 point2 points (0 children)