Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I build Notepad++ with Visual C++ 2010 Express?

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.

like image 501
thorn0 Avatar asked Sep 14 '10 15:09

thorn0


People also ask

How to write a C++ program in Visual C++ 2010 Express?

Write Your First C++ Program in VC++ 2010/2008 Step 0: Launch Visual C++ (For Visual C++ 2010 Express) Switch to "Expert Settings" Step 1: Create a New C++ Project and Solution Step 2: Write a C++ Program Step 3: Build (Compile and Link) the Project Step 4: Run the Project Next:

How to use notepad++ in Visual Studio Code?

Bookmark this question. Show activity on this post. Picked notepad++ source to learn some best practices and sneak inside code of this popular text editor. Double click on Notepad++ runk\PowerEditor\visual.net otepadPlus.vcproj to launch Notepad++ project in Visual Studio, then build it with the mode you want, that's it.

How to create a C++ project in Visual Studio?

A C++ project consists of program codes, headers, and relevant resources. Select "File" menu ⇒ "New" ⇒ "Project...". In the "Installed Templates" (or "Project Types" in VC2008) pane, expand "Visual C++" node and select "Win32".

How to create a form in Visual Studio 2010?

Open VS 2010 etc... and then create a new project of visual c# (windows forms application). Name your project , here i am naming just Notepad but you can name it something more cool. Now its time to design your Form1, which will appear right after you click "ok" when naming your application. You have to insert 2 buttons , 1 Label and 1 textBox.


2 Answers

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.

like image 190
Hans Passant Avatar answered Oct 30 '22 11:10

Hans Passant


Strange. I have Visual Studio 2010 Ultimate, and it even doesn't allow me to access the View->Property Pages menu item. It is disabled for me.

But I just went to the file no_ms_shit.props and edited that in Notepad++ only :). Then went to Project->Properties->Configuration Properties->General, and selected 'No' for treat warnings as Errors, and added _CRT_SECURE_NO_WARNINGS in the preprocessor definitions.

Don Ho should go with the flow than cursing the ms shit when he is developing in Windows and Visual Studio.


This worked for me when using Visual Studio 2012 Professional:
  • You have to edit no_ms_shit.vsprops (*.vsprops, not only *.props!):
    Replace __STDC_WANT_SECURE_LIB__=0 by __STDC_WANT_SECURE_LIB__=1

  • Add _CRT_SECURE_NO_WARNINGS to the preprocessor definitions.

like image 41
Piyush Soni Avatar answered Oct 30 '22 11:10

Piyush Soni