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

16.8k views Asked by At

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.

2

There are 2 answers

2
shf301 On BEST ANSWER

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

0
zubair afzal On

This is so easy don't worry about this. Let go to you file name and click on right side go to properties and click on linker and select the system you will see the top option of subsystem select it to first option that is Console (/SUBSYSTEM:CONSOLE)

correct image for your desire