I've Noticed Long Compilation Times... How To Do Precompiled ...

Codeforces In English По-русски Enter | Register
  • Home
  • Top
  • Catalog
  • Contests
  • Gym
  • Problemset
  • Groups
  • Rating
  • Edu
  • API
  • Calendar
  • Help
→ Pay attention Contest is runningICPC 2025 Online Winter Challenge powered by Huawei12 daysRegister now » → Top rated
# User Rating
1 Kevin114514 3814
2 Benq 3795
3 jiangly 3722
4 orzdevinwang 3670
5 ecnerwala 3592
6 ksun48 3588
7 tourist 3585
8 VivaciousAubergine 3536
9 Radewoosh 3530
10 dXqwq 3436
Countries | Cities | Organizations View all →
→ Top contributors
# User Contrib.
1 Um_nik 164
2 Qingyu 161
3 adamant 157
4 cry 153
5 Dominater069 152
5 errorgorn 152
7 Proof_by_QED 151
8 soullless 143
8 TheScrasse 143
10 Arpa 142
View all →
→ Find user Handle: → Recent actions
  • awoo → Educational Codeforces Round 186 [Rated for Div. 2] New comment(s)
  • maroonrk → AtCoder Regular Contest 155 Announcement New comment(s) Necropost
  • Asakire → Maths for CP New comment(s)
  • Asakire → Cheating in recent Edu contest New comment(s)
  • catgirl → I have solved problems on Codeforces for 500 days in a row New comment(s)
  • meligy122 → Contest Fairness at Risk New comment(s)
  • MikeMirzayanov → Goodbye, 2025. Hello, 2026! New comment(s)
  • slow.coder → KHelper: A Practical Companion for Competitive Programmers (Kotlin & Java) Text created or updated
  • phoenixforce_ → GATAWU Text created or updated
  • ezraft → rip 400+ day streak New comment(s) Necropost
  • spycoderyt → Codeforces Round 1071 (Div. 3) New comment(s)
  • bitcyber → How to setup Vim for competitive programming? New comment(s) Necropost
  • xosqedemrufo → All contests should have an unrated option New comment(s)
  • SecondThread → Meta Hacker Cup Round 3 New comment(s)
  • maroonrk → AtCoder Grand Contest 076 Announcement New comment(s)
  • Dominater069 → IICPC Global Codefest 2026 New comment(s)
  • MathModel → Invitation to Eolymp Weekend Practice #16 New comment(s)
  • telegram_cheaters → Please Stop them New comment(s) Necropost
  • akhil → YOUR CF 2025 WRAPPED New comment(s)
  • Temos_ → Girlfriend vs Tree New comment(s)
  • IanDeHaan → Teams Going to the 2026 ICPC North America Championship New comment(s)
  • alecs → How do you personally approach dynamic programming problems? New comment(s)
  • twosquares → Good Bye 2025 Editorial New comment(s)
  • KAN → Help identify broken Codeforces problems New comment(s)
  • Matsak → IZhO2026 unofficial list of participants New comment(s)
Detailed →
  • Qualified
  • Blog
  • Teams
  • Submissions
  • Groups
  • Contests

Qualified's blog

I've noticed long compilation times... How to do precompiled headers on Windows?

By Qualified, history, 6 years ago, In English

The title says it all...

  • Vote: I like it
  • +10
  • Vote: I do not like it
  • Author Qualified
  • Publication date 6 years ago
  • Comments 22
Comments Comments (10) Show archived | Write comment?
» rajkumar62506 6 years ago, show (+1) #
» rajkumar62506 6 years ago, hide # | ← Rev. 2 Vote: I like it 0 Vote: I do not like it

First, navigate to the stdc++.h file. This will be located at a directory similar to C:\MinGW\lib\gcc\mingw32\6.3.0\include\c++\mingw32\bits. Right click while pressing Shift to open a Powershell/cmd window there. Run the command g++ -std=c++17 stdc++.h, to compile the header. Take care to use the same flags you used in your build system(i.e use c++14 in command if you have build up of c++14). Check to make sure that the stdc++.h.gch file was created in the directory. Also,use "bits/stdc++.h" instead of <bits/stdc++.h> in header

Reply
  • » » Qualified 6 years ago, show (+1) #
    » » Qualified 6 years ago, hide # ^ | ← Rev. 3 Vote: I like it +1 Vote: I do not like it

    Thanks, man! This is so fast! BTW, <bits/stdc++.h> runs in the same time as "bits/stdc++.h" so what is the difference?

    Reply
    • » » » rajkumar62506 6 years ago, show (+1) #
      » » » rajkumar62506 6 years ago, hide # ^ | Vote: I like it 0 Vote: I do not like it

      Actually I have read in this blog Link,according to this "bits/stdc++.h" use precompiled headers whereas <bits/stdc++.h> doesn't. IDK what's actual mechanism happening but in my case "bits/stdc++.h" working very good so I recommend that.

      Reply
      • » » » » KiBie 6 years ago, show (+1) #
        » » » » KiBie 6 years ago, hide # ^ | Vote: I like it 0 Vote: I do not like it

        'Take care to use the flags' what is this step mean ? And how can I be sure that I'm using the precompiled headers rajkumar62506

        Reply
        • » » » » » rajkumar62506 6 years ago, show #
          » » » » » rajkumar62506 6 years ago, hide # ^ | Vote: I like it 0 Vote: I do not like it

          1)take care of flags means which c++ version you are using.if you are using c++14 then run command will be g++ -std=c++14 stdc++.h. 2)This info you can find on google by reading few blogs,once I was searching about precompiling header I was found it but I was not understood.But I can easily detect it by huge difference in compiling time.

          Reply
    • » » » dush1729 6 years ago, show #
      » » » dush1729 6 years ago, hide # ^ | Vote: I like it 0 Vote: I do not like it

      click

      Reply
  • » » Tapojit047 4 years ago, show #
    » » Tapojit047 4 years ago, hide # ^ | Vote: I like it 0 Vote: I do not like it

    When I try to compile it using command prompt, I get this error "The term 'g++' is not recognized as the name of a cmdlet, function, script file...". Any solution?

    Reply
  • » » Tapojit047 4 years ago, show #
    » » Tapojit047 4 years ago, hide # ^ | Vote: I like it 0 Vote: I do not like it

    I compiled the header, but .gch is not created. Any solution?

    Reply
» ajitshiva007 5 years ago, show (+1) #
» ajitshiva007 5 years ago, hide # | Vote: I like it 0 Vote: I do not like it For Linux Users Go to /usr/include/x86_64-linux-gnu/c++/9/bits For Windows Users Go to C:\MinGW\lib\gcc\mingw32\6.3.0\include\c++\mingw32\bits Then run this command g++ -std=c++17 stdc++.h in your terminal or cmd, it will create stdc++.h.gch file. That's all. It will boost your compile time 8x faster. Reply
  • » » BitSane 4 years ago, show #
    » » BitSane 4 years ago, hide # ^ | Vote: I like it 0 Vote: I do not like it

    Thanks a lot, I was searching for this in Ubuntu!

    Reply
In English In Russian ↑ ↓ Codeforces (c) Copyright 2010-2025 Mike Mirzayanov The only programming contests Web 2.0 platform Server time: Dec/30/2025 07:28:02 (g1). Desktop version, switch to mobile version. Privacy Policy | Terms and Conditions Supported by TON ITMO University User lists
Name

Từ khóa » .h.gch C