liamkf / Unreal_FASTBuild

Allows UnrealEngine to be built with FASTBuild for VS2015/VS2017 and Windows 10.
MIT License
179 stars 71 forks source link

concatenation of TEXT("XXX") error #21

Closed changshuang closed 6 years ago

changshuang commented 6 years ago

Here is a sample:

class FASTBUILD413_API Afastbuild413GameMode : public AGameMode
{
    GENERATED_BODY()

        int a;

    void testx();
    void dfaf(const wchar_t* str);
};

void Afastbuild413GameMode::testx()
{
    dfaf( TEXT("\x5927\x9003\x6740\x6362\x88c5\x76f8\x5173")TEXT("BP\x7ed3\x6784\x6570\x636e"));
}

void Afastbuild413GameMode::dfaf(const wchar_t* str)
{

}

Environment: Platform:windows7 Vs:vs2015 wiht update 1 Unreal:4.13 Win10sdk installed but no used

If i do not use fastbuild, it will be compiled ok with no error. But if using fastbuild, compiling fails with error: 2>C:\Work\Project\fastbuild413\Source\fastbuild413\fastbuild413GameMode.cpp(9): error C2022: '32467': too big for character 2>C:\Work\Project\fastbuild413\Source\fastbuild413\fastbuild413GameMode.cpp(9): error C2022: '26500': too big for character 2>C:\Work\Project\fastbuild413\Source\fastbuild413\fastbuild413GameMode.cpp(9): error C2022: '25968': too big for character 2>C:\Work\Project\fastbuild413\Source\fastbuild413\fastbuild413GameMode.cpp(9): error C2022: '25454': too big for character 2>C:\Work\Project\fastbuild413\Source\fastbuild413\fastbuild413GameMode.cpp(9): error C3688: invalid literal suffix 'L'; literal operator or literal operator template 'operator ""L' not found

From microsoft, we can see tihis is an known error. But without fastbuild, it builds succeeded. I guess vc do something when preprocessor process definitions. But i can not fix the problem.

Need your help, many thanks!

ffulin commented 6 years ago

This is a preprocessor bug in VS2015. It has been fixed in VS2017. (It also doesn't happen in VS2013)

The reason you encounter this bug with FASTBuild is because it uses the preprocessor to power distributed compilation and caching.

If you are unable to update to VS2017, it seems you can work around this bug by inserting a space between the TEXT macros as follows:

dfaf( TEXT("\x5927\x9003\x6740\x6362\x88c5\x76f8\x5173") TEXT("BP\x7ed3\x6784\x6570\x636e"));
ffulin commented 6 years ago

Link back to the related FASTBuild ticket: https://github.com/fastbuild/fastbuild/issues/347

changshuang commented 6 years ago

fastbuild/fastbuild#347 has fixed it. Many thanks!