Scene
When adding new x.h/x.hpp/X.C/x.cpp files to the UE4 project, even if there are no other files to include these new files, the following errors may appear during compilation (both build and rebuild):
unrealbuildtool prerequisites are different
this error occurs when the x.obj file is compiled, but the link operation cannot be performed correctly
reason
As the name suggests, there is no problem with the code itself, but that the code block cannot be integrated into the existing project. UE4 has preprocessing on the path for the include file. If the path name of the file is duplicate, this problem will occur. For example:
1. Proto/error.pb.h already exists under module
2. try to add Server/XXServer/proto/error.pb.h
According to the include rule of UE4, #include "proto/error.Pb.H"
may point to two files at the same time (when the files in the server/xxserver directory are imported), so it cannot be judged accurately, and an error is reported during compilation.
Note: unrealbuildtool under Windows does not judge case, and the paths of proto/and proto/are the same
Solution:
directory paths should not overlap. Try to avoid the path with the same name.
-
There should be no files with the same name under the path