When using WPP in Visual Studio (2012) each occurence of TraceEvents(...) has a wavy underline and the help text is e.g.
#define TraceEvents WPP_(CALL)
error: identifier WPP_Call_Foo_cppNNN not defined
Well, it is defined, in the .tmh header file created by the WPP preprocessor and the project compiles just fine. But Visual Studio doesn't scan and/or recognize this file.
Is there a practical way of getting rid of those squiggles?
For now I work around the problem by putting
#ifdef __INTELLISENSE__
#undef TraceEvents
#define TraceEvents(a,b,...)
#endif
in one of the header files that are included after the .tmh in all of the files anyway.
The define __INTELLISENSE__ is mentioned in http://blogs.msdn.com/b/vcblog/archive/2011/03/29/10146895.aspx
Edit for Visual Studio 2012:
It appears you've reached the analysis limit of the preprocessor in Visual Studio 2012's IntelliSense engine. If you replace the TraceEvents reference with WPP_Call_Foo_cppNNN, it actually resolves the identifier without problems (until you rebuild the solution and the tmh header changes).
The solution is to load the solution in Visual Studio 2013, and choose to not upgrade the compiler toolchain, thus preserving backwards compatibility with Visual Studio 2012.
Previous Answer for Visual Studio 2013:
This was tested in Visual Studio 2013, so it may not apply to Visual Studio 2012. I couldn't find a release of the WDK that supports Visual Studio 2012, so you'll need to let me know how to configure the environment if the following steps do not work.
After building your project (to ensure the .tmh files exist), execute the Project → Rescan Solution command.
I also recommend you associate the files with the C++ editor through the following steps:
Open Tools → Options... → Text Editor → File Extension
Associate extension tmh with editor Microsoft Visual C++
Switch off the Live Semantic Errors in Options->Text Editor->C/C++ -> Advanced ...
Related
This problem is making me mad.
We have a set of projects that rely on T4 templates to generate code for a bunch of DSLs.
Every time I try to transform one of these T4 templates in Visual Studio 2015 I get this window, the security warning:
I have set the "Do not show this message again".
I have set the VS option "Text Templating | Show Security Message" to false.
Every time I restart Visual Studio 2015 and transform the first template the message pops up again.
This does not happen in Visual Studio 2013.
Some hints that may have something to do with this:
The actual text template that is called is published by a VS extension that is installed in the admin extensions directory ($ProgramFiles$\Microsoft Visual Studio 12.0\Common7\IDE\Extensions).
We are using our own custom code generator (that derives from TemplatedCodeGenerator).
Any ideas?
I have found the solution to this one a little by chance.
The problem was that the assembly containing the custom code generator was referencing Microsoft.VisualStudio.TextTemplating.VSHost.12.0 instead of version 14.0 as for Visual Studio 2015.
Oddly enough the transformation did not complain about the problem with the reference but completely ignored the VS option to stop showing the security dialog (may be because it was reading it from the wrong place?).
After correcting the reference, the problem never happened again.
I have seen and used a rename feature in Visual Studio 2010.
However when editing code in C++ mode, I see no "Refactor" menu, and the CTRL+R CTRL+R command produces the following error message:
The key combination (Ctrl+R, Ctrl+R) is bound to command (Rename...) which is not currently available.
Eclipse seems to have got this right. Is there no rename feature in VS 2010 for VC++?
Is there no rename feature in VS 2010 for VC++?
That is correct. None of the refactoring features work for C++ projects (C# and VB only). If you want these things, you need to use a third party plugin, such as Visual Assist.
In Visual Studio 2005, I have a .h file with preprocessor macros in it. They are apparently too complicated for Visual Studio's Intellisense because they make Visual Studio crash if they are present whereas it works fine if they are not. Does anyone know of a way to prevent Visual Studio parsing the file for Intellisense but still include it in the build. By the way, I have already tried the following:
Disabling Intellisense by renaming feacp.dll. Works, but impractical.
Visual Assist. Works, but $250.
Installing Visual Studio SP1 + the Intellisense hotfix (KB947315). Doesn't fix it (and ate 1GB of hard drive space).
The first thing to try is to install Visual Studio 2005 SP1. This fixes a lot of intellisense related issues which may help you out
http://msdn.microsoft.com/en-us/vstudio/bb265237.aspx
If that doesn't fix the problem try excluding the file from the project. This prevents it any any of it's contents from appearing in Visual Studio features (such as intellisense). If it's just a header file it shouldn't impact the build as the actual file won't be removed, it just won't be considered part of the project.
Ok, for the benefit of others, I'm going to solve this myself! I've been fiddling and the answer is as follows. If you have this problem, and you delete your ncb file to force Intellisense to update, you can prove to yourself that this works.
#ifdef out the offending code in your .h file as follows:
#ifdef SOMETHING_UNIQUE
<the offending code>
#endif
in the file that actually uses the macros (the cpp file that #includes the .h file):
#define SOMETHING_UNIQUE
Intellisense will now ignore the code in the .h file that causes it to crash (it will be greyed out in the editor), but it still gets compiled.
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.
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.
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.
A closer look at the source would show that most of the library calls that cause endless noise unless you use this property sheet come from the SciLexer.dll project. Scintilla is cross platform, so it doesn't need all the Windows specific cruft.As you mentioned, Microsoft went overboard with their replacing the standard string library, as legitimate as their attempt to avoid buffer overruns may be.
So you may direct this criticism to Neil Hodgson (main developer of Scintilla) rather than Don Ho.
CChris
I just moved from Visual Studio 2008 to Visual Studio 2010 (final) and noticed one major flaw:
When I try to use AutoComplete in a C++ source file for managed C++, a small note in the footer appears:
IntelliSense for C++/CLI is not available
Uh, has IntelliSense for C++/CLI been dropped from Visual Studio 2010? Is there any way to get this back? It is rather useful...
You are correct. Unfortunately it has been dropped. You can check this opened issue on Microsoft's Connect website.
I'll just quote them for the sake of the answer:
Unfortunately in this release we had to cut the intellisense support for C++/CLI due to time constraints. If you want to get some intellisense like quick info and memberlist on the native classes you can get it by choosing no /clr support in the project properties.
About getting back intellisense, your best chances for now are using third-party tools like VA Assist for example. I've tried it with Visual Studio 2008 and its IntelliSense is a whole lot better than the default one.
It is available again in Visual Studio 2012.
If you want to get IntelliSense back, install Visual Assist X from Whole Tomato Software. Here you can get a 30-days trial to check the intellisense.
According to the Visual C++ Team Blog, C++/CLI Intellisense will be in the next version of Visual Studio, but not in a service pack for VS2010. That blog post also gives some detail as to what went wrong and led to this sad state.
I don't know if you can use this settings but it work for me. I only check the Common Language RunTime Support for the cpp files that use it. I do not check it for the whole project and I've got intellisense for all the files that don't use the CLI.
Yes! you can enable the IntelliSence, but in a tricky way. Follow these instructions:
Go to your project properties. (Right click on your project name in
Project Explorer, and select Properties. or simply Alt + Enter)
From Configuration Properties, select General
In the right-hand section, find "Common Language Runtime Support"
and change it to "No Common Language Runtime Support".
Click the OK Button.
Now the IntelliSence is working. But a problem is an error when you compile your code! (The error is: error LNK1123: failure during conversion to COFF: file invalid or corrupt)
You can simply go back to Project Properties an change Common Language Runtime Support to "Common Language Runtime Support, Old Syntax (/clr:oldSyntax)".
Good luck.
This solution is only if you don't want Common Language Runtime
It worked for me in VS2010
Go to Project Propreties > Configuration Properties > General > Common Language Runtime Support and set it to No Common Language Runtime Support.
This will work fine just after hitting Apply button.
As mentioned you could install some paid software such as "Visual Assist X from Whole Tomato Software".
or
You could use open source tools that contain intellisense*, one such tool is Qt Creator 3.3.1 (opensource). You have two options, either setup your entire project with Qt to compile using VS2010 compiler, or use Qt to link to your source files and compile with VS2010. You write your code in Qt, save, flip windows to vs2010 and compile and debug.
When changes are saved in Qt, vs2010 will automatically reload the source file in the project and you can compile.