I believe you are getting this error message because you have used Visual C++ 2008 to create a win32 project but a win32 project does not use main() as the entry point to the program, and so the compiler does not know where to start.
I am using Visual studio 2010 to get this information (by creating a non empty win32 project) but in theory it should be the same... you need to use the following to replace your main()...
1 2 3 4 5 6 7
int APIENTRY _tWinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow)
{
// your code from main() goes here
}
... or you could create a new console project and copy your current code into that (since console projects use either main() or main(int argc, char *argv[]) as their program entry points).
I don't think the WinMain suggestion was appropriate here. The errors suggest that you are trying to build two console exe projects : utility.exe (which cannot find main) and main.exe (which find class S)
If you want to build a utility library, you need to create a new project which creates utility.lib rather than utility.exe (I would use a static library here). In this case you then have to link main.exe to utility.lib.
Alternatively, you could just move utility.h and utility.cpp to the main project and compile and link everything as one.
I am new to Visual Studio 2008, please can you explain in more details the second option:
If you want to build a utility library, you need to create a new project which creates utility.lib rather than utility.exe (I would use a static library here). In this case you then have to link main.exe to utility.lib.