Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Creating C++ classes and plug-ins without PCH files

When I created c++ classes and plug-ins with version 4.22, I didn't generate PCH files. Why? What is a PCH file? Why is it not generated? How should I generate it manually?

Product Version: UE 4.22
more ▼

asked May 15 '19 at 07:22 PM in C++ Programming

avatar image

22 2 2 6

avatar image 哇哈哈咩 May 15 '19 at 07:51 PM

I begged for help in answering questions that had been bothering me for hours.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

A PCH is a precompiled header. When you write a C++ program you usually include some headers that allow you to call functions that were written by somebody else and which exist on your machine somewhere. When you compile a program (build a project) the compiler will go through all the source code that you have written and that you have referenced in your header files and turn it from your source code (text files) to binary (executable).
Pre compiled headers were designed to allow you to compile your project faster by having code that you will not change (code in the headers that you do not touch) exist as pre compiled files so, the compiler only needs to compile the small amount of code that you have written and not bother itself with a load of code that has not been changed and so does not need to be re-compiled. This page might or might not help you:- https://docs.unrealengine.com/en-us/Programming/BuildTools/UnrealBuildTool/IWYU

more ▼

answered May 15 '19 at 09:26 PM

avatar image

251 4 7 13

avatar image 哇哈哈咩 May 16 '19 at 08:41 AM

Thank you very much. I can understand the reason for this. Besides, please ask me why the amount of code I write at a time is not so large and why the compilation time is so long.

avatar image Podgyhodgy May 16 '19 at 03:30 PM

How long is 'so long'? A couple of minutes to compile or build is normal for me when I make a small change in my code. I have a very ordinary machine (2.4GHz, 4 core processor & 16 Gb DDR3 memory. You can try watching your cpu usage using task manager- performance to see if your processor is running as fast as it can and your memory usage. Also, is your hard disk light always on when compiling? - a slow hard disk can be a bottleneck. Maybe you need a faster (ssd) one? But, my hard disk is old and slow and does not give me a big problem. Except when I compiled the engine from source code which took me 2 hours. Made my processor overheat because of dust on it. I had to clean it off to stop my machine crashing. It worked in the end though. I do not know everything that the Unreal build tool does during the compile but it is more complex than a simple compile of an executable. It must integrate your code with the editor too. I have yet to read a detailed description of how the build tool works.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question