Unrecognized Flag '-Yu' in 'p2' #1378

Closed
opened 2026-01-30 22:24:06 +00:00 by claunia · 14 comments
Owner

Originally created by @Tembocs on GitHub (May 27, 2019).

Trying to build from Windows 10 x64 using Visual Studio 2019 and got his error message.
unrecognized flag '-Yu' in 'p2'. This is from the current master branch. How do I resolve this? Is it something to do with UTF-8? What is the workaround then? Can't be applied to the whole repo? I have tried to search related issues without success with proposed solutions.

Originally created by @Tembocs on GitHub (May 27, 2019). Trying to build from Windows 10 x64 using Visual Studio 2019 and got his error message. ```unrecognized flag '-Yu' in 'p2'```. This is from the current master branch. How do I resolve this? Is it something to do with UTF-8? What is the workaround then? Can't be applied to the whole repo? I have tried to search related issues without success with proposed solutions.
Author
Owner

@zadjii-msft commented on GitHub (May 28, 2019):

Could you give some more context on that error text? I've never seen it before.

@zadjii-msft commented on GitHub (May 28, 2019): Could you give some more context on that error text? I've never seen it before.
Author
Owner

@bjohnson-fsi commented on GitHub (May 30, 2019):

Getting the same error when trying to build for x64 using Visual Studio 2019.

Full Error List:

image

@bjohnson-fsi commented on GitHub (May 30, 2019): Getting the same error when trying to build for x64 using Visual Studio 2019. Full Error List: ![image](https://user-images.githubusercontent.com/51176231/58634465-5cdc1a80-82b9-11e9-911d-46d1fcc165c7.png)
Author
Owner

@mmdanggg2 commented on GitHub (Jun 1, 2019):

I'm getting this too, trying to build x64 Release, Debug builds fine...
image

@mmdanggg2 commented on GitHub (Jun 1, 2019): I'm getting this too, trying to build x64 Release, Debug builds fine... ![image](https://user-images.githubusercontent.com/3161587/58750241-beea7a80-8487-11e9-923d-e56b63b42878.png)
Author
Owner

@kopwei commented on GitHub (Jun 1, 2019):

The same. Debug x64 build passed but Release x64 failed with same issue.

1>------ Build started: Project: TerminalConnection, Configuration: Release x64 ------
1>LINK : fatal error C1007: unrecognized flag '-Yu' in 'p2'
1>LINK : fatal error LNK1257: code generation failed
1>Done building project "TerminalConnection.vcxproj" -- FAILED.
2>------ Build started: Project: TerminalControl, Configuration: Release x64 ------
2>LINK : fatal error C1007: unrecognized flag '-Yu' in 'p2'
2>LINK : fatal error LNK1257: code generation failed
2>Done building project "TerminalControl.vcxproj" -- FAILED.

@kopwei commented on GitHub (Jun 1, 2019): The same. Debug x64 build passed but Release x64 failed with same issue. 1>------ Build started: Project: TerminalConnection, Configuration: Release x64 ------ 1>LINK : fatal error C1007: unrecognized flag '-Yu' in 'p2' 1>LINK : fatal error LNK1257: code generation failed 1>Done building project "TerminalConnection.vcxproj" -- FAILED. 2>------ Build started: Project: TerminalControl, Configuration: Release x64 ------ 2>LINK : fatal error C1007: unrecognized flag '-Yu' in 'p2' 2>LINK : fatal error LNK1257: code generation failed 2>Done building project "TerminalControl.vcxproj" -- FAILED.
Author
Owner

@baget commented on GitHub (Jun 2, 2019):

Could you give some more context on that error text? I've never seen it before.

I also saw this.

  • Clone the repro,
  • Update the submodules
  • Opened with VS2019
  • upgrade the solution
  • build the solution.

This is the Error that I get

27>------ Build started: Project: Host.unittest, Configuration: Release x64 ------
25>readData.cpp
27>precomp.cpp
25>readDataDirect.cpp
25>readDataRaw.cpp
25>registry.cpp
15>Nihilist.vcxproj -> D:\MyProjects\GitHub\terminal\\bin\x64\Release\Nihilist.exe
24>LINK : fatal error C1007: unrecognized flag '-Yu' in 'p2'
24>LINK : fatal error LNK1257: code generation failed
@baget commented on GitHub (Jun 2, 2019): > Could you give some more context on that error text? I've never seen it before. I also saw this. - Clone the repro, - Update the submodules - Opened with **VS2019** - upgrade the solution - build the solution. This is the Error that I get ``` 27>------ Build started: Project: Host.unittest, Configuration: Release x64 ------ 25>readData.cpp 27>precomp.cpp 25>readDataDirect.cpp 25>readDataRaw.cpp 25>registry.cpp 15>Nihilist.vcxproj -> D:\MyProjects\GitHub\terminal\\bin\x64\Release\Nihilist.exe 24>LINK : fatal error C1007: unrecognized flag '-Yu' in 'p2' 24>LINK : fatal error LNK1257: code generation failed ```
Author
Owner

@braindef commented on GitHub (Jun 4, 2019):

i have the same Error...

@braindef commented on GitHub (Jun 4, 2019): i have the same Error...
Author
Owner

@HimiSaber commented on GitHub (Jun 4, 2019):

Right click solution -->retarget solution,change to latest

@HimiSaber commented on GitHub (Jun 4, 2019): Right click solution -->retarget solution,change to latest
Author
Owner

@boldcronie commented on GitHub (Jun 7, 2019):

I had the same error. VS2019/tools v142, and every build failed with at least two modules returning the "Unrecognized flag -Yu in p2" error. Re-targeted after clone, and individually re-targeted the UWP projects that didn't move from 141 to 142 during the initial re-target. Still got the errors during every build.

Tried HimiSaber's solution -- after another failed build, right-clicked the OpenConsole.sln and clicked Re-target solution. That finished, so I built again. No errors! Launching the WindowsTerminal.exe still didn't work (would appear, then disappear after a few seconds), but I deployed anyway. Only took a few seconds, as the solution had been properly built. Checked Start Menu, and Windows Terminal (Dev Build) was there and working!

Thank you HimiSaber! I almost didn't try it, as I'd already re-targeted several times.

@boldcronie commented on GitHub (Jun 7, 2019): I had the same error. VS2019/tools v142, and every build failed with at least two modules returning the "Unrecognized flag -Yu in p2" error. Re-targeted after clone, and individually re-targeted the UWP projects that didn't move from 141 to 142 during the initial re-target. Still got the errors during every build. Tried HimiSaber's solution -- after another failed build, right-clicked the OpenConsole.sln and clicked Re-target solution. That finished, so I built again. No errors! Launching the WindowsTerminal.exe still didn't work (would appear, then disappear after a few seconds), but I deployed anyway. Only took a few seconds, as the solution had been properly built. Checked Start Menu, and Windows Terminal (Dev Build) was there and working! Thank you HimiSaber! I almost didn't try it, as I'd already re-targeted several times.
Author
Owner

@Tembocs commented on GitHub (Jun 7, 2019):

@HimiSaber and @boldcronie, thank you so much this works. I have successful built WindowsTerminal and deploy. Its working and fast.

@Tembocs commented on GitHub (Jun 7, 2019): @HimiSaber and @boldcronie, thank you so much this works. I have successful built WindowsTerminal and deploy. Its working and fast.
Author
Owner

@DHowett-MSFT commented on GitHub (Jun 10, 2019):

This will be fixed by #1012.

@DHowett-MSFT commented on GitHub (Jun 10, 2019): This will be fixed by #1012.
Author
Owner

@ghost commented on GitHub (Jun 17, 2019):

I still have this error.

@ghost commented on GitHub (Jun 17, 2019): I still have this error.
Author
Owner

@oliver-ni commented on GitHub (Jun 21, 2019):

@NycuRO did you try @HimiSaber's solution? Worked for me

@oliver-ni commented on GitHub (Jun 21, 2019): @NycuRO did you try @HimiSaber's solution? Worked for me
Author
Owner

@ghost commented on GitHub (Jun 21, 2019):

i fixed. but when i use ubuntuu profile i've got gray screen only.

@ghost commented on GitHub (Jun 21, 2019): i fixed. but when i use ubuntuu profile i've got gray screen only.
Author
Owner

@devinvisible commented on GitHub (Dec 7, 2020):

I had a similar issue in a completely unrelated project. Going into my project properties and setting Linker -> General -> Show Progress to /VERBOSE gave me a clue -- it showed a library of mine that it was searching for. A stack overflow comment suggested this was caused by this library being built with a different version of visual studio. I rebuilt both using the same version of visual studio (being mindful to build the appropriate architecture & release) and this error went away.

@devinvisible commented on GitHub (Dec 7, 2020): I had a similar issue in a completely unrelated project. Going into my project properties and setting Linker -> General -> Show Progress to /VERBOSE gave me a clue -- it showed a library of mine that it was searching for. A stack overflow comment suggested this was caused by this library being built with a different version of visual studio. I rebuilt both using the same version of visual studio (being mindful to build the appropriate architecture & release) and this error went away.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#1378