Contact | License

# 1301 - Precompiled Header target '%s' has already been defined.

Description
A Precompiled Header definition was encountered, but the Precompiled Header output conflicts with an existing target.
PrecompiledHeaders can be shared between multiple ObjectList or Library declarations, but must only be declared once.
Example
Config:
.Configs = { 'debug', 'release' } ForEach( .Config in .Configs ) { ObjectList( 'lib-$Config$' ) { .Compiler = 'cl.exe' .CompilerInputPath = 'Code/' .CompilerOutputPath = 'tmp/' .CompilerOptions = '%1 %2' .PCHInputFile = 'PrecompiledHeader.cpp' .PCHOutputFile = 'PrecompiledHeader.pch' // Not unique .PCHOptions = '%1 %2' } }
Output:
c:\Test\fbuild.bff(4):(5) FASTBuild Error #1301 - Library() - Precompiled Header target 'PrecompiledHeader.pch' has already been defined. Library( 'lib-$Config$' ) ^ \--here
Fix:
.Configs = { 'debug', 'release' } ForEach( .Config in .Configs ) { ObjectList( 'lib-$Config$' ) { .Compiler = 'cl.exe' .CompilerInputPath = 'Code/' .CompilerOutputPath = 'tmp/' .CompilerOptions = '%1 %2' .PCHInputFile = 'PrecompiledHeader.cpp' .PCHOutputFile = '$Config$/PrecompiledHeader.pch' // Unique .PCHOptions = '%1 %2' } }