views:

189

answers:

2

Windows SDK is installed. I built N++ successfully with Visual C++ 2008 Express before. But now with 2010 I have a lot of error messages about sprintf_s:

1>C:\Program Files\Microsoft Visual Studio 10.0\VC\include\string(676): error C2039: 'sprintf_s' : is not a member of '`global namespace''
1>C:\Program Files\Microsoft Visual Studio 10.0\VC\include\string(676): error C3861: 'sprintf_s': identifier not found

Please help.

+3  A: 

There's a property sheet included with the project named no_ms_shit.props (after conversion). There's a fair amount of hate expressed in that sheet for what MS has been trying to do for the past 5 years.

They went a little too over-board with turning everything off, they even disabled linking to sprintf_s(). Which is the source of your error, the stdio.h header omits the declaration but the string header uses it. Not sure if the Express edition supports editing project property sheets, but the step in the retail edition are:

  • View + Property Manager
  • Open one of the nodes and locate "no ms shit"
  • Right-click it, Properties
  • C/C++, Preprocessor, Preprocessor Definitions
  • Change __STDC_WANT_SECURELIB__=0 to 1
  • Add _CRT_SECURE_NO_WARNINGS to those definitions

The project compiles clean now. I do get a build error for copying files, it is a post-build event. Start another question if you can't figure out how to fix it.

Hans Passant
Thank you! Indeed Express edition doesn't have Property Manager. But I've found where to change these preprocessor settings (Project + Properties + Configuration Properties...). It builds now.
thorn