LINK : fatal error LNK1221: a subsystem can't be inferred and must be defined

John picture John · Oct 15, 2011 · Viewed 14.9k times · Source

I have no other errors or warning in my solution, which would be great but this error has totally baffled me. I have three projects, one references none, and the other two both reference it.

One is a windowsservice, ah, that is also the one that doesn't link, I think this means I ought to add the service installer class in the morning, thought the MS example doesn't bother on the ServiceBase page of MSDN : http://msdn.microsoft.com/en-us/library/system.serviceprocess.servicebase%28v=VS.80%29.aspx

I'll need to test that example later. But if anyone can help in the mean time, thanks.

The project with no references is a dll. The other is a standard app, which up until about a month ago was all that I'd considered building.

Answer

shf301 picture shf301 · Oct 15, 2011

You need to set the subsystem in your C++ project under Project Properties -> Configuration Properties -> Linker -> System -> SubSystem. And you probably want to use SUBSYSTEM:WINDOWS.

enter image description here