Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. PCH file?
Qt 6.11 is out! See what's new in the release blog

PCH file?

Scheduled Pinned Locked Moved Solved Qt Creator and other tools
4 Posts 2 Posters 805 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • davecotterD Offline
    davecotterD Offline
    davecotter
    wrote on last edited by
    #1

    i was under the impression that adding a PCH file effectively #includes that file in every single source file in my project. is this not true? must i also type #include <my_pch.h> into every source file? or: how do i get that file to be effectively included in every source?

    JonBJ 1 Reply Last reply
    0
    • davecotterD Offline
      davecotterD Offline
      davecotter
      wrote on last edited by
      #4

      windows (msvc):

      QMAKE_CXXFLAGS +=     /FI"stdafx.h"
      
      1 Reply Last reply
      0
      • davecotterD davecotter

        i was under the impression that adding a PCH file effectively #includes that file in every single source file in my project. is this not true? must i also type #include <my_pch.h> into every source file? or: how do i get that file to be effectively included in every source?

        JonBJ Offline
        JonBJ Offline
        JonB
        wrote on last edited by
        #2

        @davecotter
        .pch just means pre-compiled header. It's for speed. It doesn't "actively put" anything into your file.

        You still have to choose what you #include in your source files. You can achieve getting multiple files included in source files in "one line" by having one .h header file have #include other files in it.

        1 Reply Last reply
        0
        • davecotterD Offline
          davecotterD Offline
          davecotter
          wrote on last edited by
          #3

          thanks for that. does anyone know a way to specify that a certain header file be automatically included in every file that is compiled, without having to type it in at the top of every .cpp file?

          1 Reply Last reply
          0
          • davecotterD Offline
            davecotterD Offline
            davecotter
            wrote on last edited by
            #4

            windows (msvc):

            QMAKE_CXXFLAGS +=     /FI"stdafx.h"
            
            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved