I am developing visual game level editor in C++.
For this I want reflection(RTTI) mechanism to know class attributes at runtime.
I am currently using PDB files for this.But using PDB I couldn't retrieve actual code line for extra information in commented format which is given for that attribute.
Visual studio uses NCB files for intelligence.
So will it be better idea to use NCB instead PDB?
If yes,How to retrieve information from NCB files?
Is there any SDK like DIA SDK?
The NCB file format isn't publicly documented and changes with every version of Visual Studio. With the upcoming VS2010 (due out in about a week and a half), it's going away entirely in favor of a new SQL-based format that should be much easier to work with. Microsoft is also implementing an API for integrating with the Intellisense data from the parser.
I really wouldn't rely on the .ncb files for reflection. Those files are meant for intellisense, and only intellisense. They could change without warning, not be up to date, or what have you...
You could do some macro hackery to get the reflection you seek (something like push your variables/methods into some container, and declare it simultaneously)... or use a framework like Qt (which is what I've been using for my level editor).
Related
I would like to build a tool that takes a set of C/C++ headers and macro definitions and outputs a list of visible types, functions, variables, and macros, preferably with full type information. At first, I thought about using the Clang APIs, but I primarily wanted to use this tool on the Windows SDK headers and I would probably need to pre-process them to get Clang to parse them correctly. The C++ parser in Visual Studio already extracts the information I need, so it would be nice if I could just use that.
Is it possible to do something like that without writing a Visual Studio extension?
I have to use text files files on my project on Visual Studio, and instead of working with file streams I'd like to add them directly to the build.
I have added them to the solution explorer and edited their properties changing the Item Type to Resource.
Now I want to know how may I access their content, say, put their text into a string. (I'm using C++)
PS: Is there a good tutorial about using resource files? Couldn't find any recent tutorial for visual studio.
To retrieve a user-defined resource from within your executable see the FindResource, LoadResource and LockResource APIs.
I've got a program written in c++ and have to make some modifications to it. Howerver, I haven't got any solution file or a like, just a bunch of .h, .cpp, .obj, .dpb, .dll, .mdi, .dfm, .res, .tds, .bpl files and an .exe file.
So I can start an application, see what it's doing and what the controls are, but when it comes to adding changes trying do to map behaviour of UI to source code files seems just to tedious.
Is it possible to recreate some kind of solution file or just to simply the process? (I am using VS 2012 and an app was written in 2002).
These file extensions indicate the source is from a Borland IDE. That .mdi file I think signifies Borland's multiple-document-interface... I'll venture to guess this project would be quite difficult to "recompile" using Visual Studio. I don't even see a .rc (resource file) in your list. Rewriting may be the easiest path, depending on the complexity of the application...
This may be a duplicate, but I haven't found anything that answers it thus far. My company passed a resolution that all files need to have a boilerplate comment header, with file name and copyright date among other things. I was hoping there would be an easy way to just create a header template that is added to the top of every new class (.cpp and .h files) added to the project with a couple of variables that are replaced based on the date, file name, etc.
Unfortunately, it seems like this is a much larger task that it seems it should be. I've looked into Manipulating Code using the Visual C++ Code Model and Manually Creating an Item Template and can't seem to get any of them to do what I want.
Sorry if this sounds like a "do my work for me" post, but to me this just isn't worth spending that much time on. If it's going to take a day to figure out the subtleties of extending Visual Studio, I can just manually add and edit the header for each new file, as it isn't done that often. Is there an easier method than those I was looking at, or a simple example on how to utilize those methods for my purpose?
This may not get you any further than you have already got, but Simon is close in that you can create C++ file templates in the way that he suggests, but the path to the C++ templates is C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\vcprojectitems (note that on 32-bit machine it will just be Program Files).
If you edit the file NewC++File.cpp, the next time you add a new C++ file to a project your template will be used. Alternatively you can create your own files in this folder and they will appear in the Add New Item dialog.
This won't solve your problem around inserting the current date in the header (assuming you want that to be automatically determined), but you could update the template that you're using once a year, and that would be slightly less of a chore.
HTH
What you are looking for is called : Code Snippets
I personnaly use the snippets provided into VAssistX but it's a shareware so it's might not be a good solution for your company.
By the way if you are developing application on Visual C++ without VAssistX you are wasting a lot of time ;)
There is also a code snippets manager into Visual Studio, i never used it but i found some documentation on google :
http://msdn.microsoft.com/en-us/library/d60kx75h(VS.80).aspx
and
http://blogs.microsoft.co.il/blogs/gilf/archive/2009/01/17/how-to-write-your-own-code-snippets.aspx
I hope it's will be helpfull.
Update: Unfortunately, the C++ templates do not work in the same way.
I have left the text below as a reference to anyone who finds this, but it only works for C#/VB.
You can definitely edit the class template for C# (we have done it for exactly the same reason as you - to include a standard header), I would assume you can do it for C++ too.
Check out these two directories:
"C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\ItemTemplates\"
"C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\ItemTemplatesCache\"
Somewhere in each of those directories will be a class template folder. For C# it's in a zip file here:
...\ItemTemplates\CSharp\Code\1033\Class.zip
Extract the zip, edit the template to include your header and re-zip it. You will also then need to place an unzipped copy under the ItemTemplatesCache folder, (following the same path - ...\ItemTemplatesCache\CSharp\Code\1033\Class)
There are more details here.
(Sorry, I'm on my Linux PC now so I can't check if these paths exist for C++. If you get it to work, post the correct C++ paths back here, and I'll update this answer to reference them)
I got a huge C++ third-party project with set of project in one solution. So build time is rather long and Browse Information generation takes a lot too. So what is the purpose of Browse Information? What functionality will be lost if i disable Browse information generation?
Visual Studio 6 required browse information to do the things that Doug T. mentioned.
Newer versions of visual studio can use the browse information file, but by default use a newer Intellisense database. For those versions, there is basically an Intellisense daemon that builds the database in the background instead of being directly embedded in the build process. It really helps to have more than one processor or core when using Intellisense. Otherwise it can really bog down your system.
From here
Select Generate Browse Info under the
C/C++ project settings tab, for any
source-files that you want to be
included. This is very useful for
searching for function definitions and
declarations - just right-click a
function / variable and select "Goto
Definition Of..." and the IDE will
take you straight there.
You will lose some ability to easily navigate your code. This may matter a lot in a very large code base. I know that without it and tools like Visual Assist X, I would be lost. Still, Visual Studio has a very efficient find-in-files operation that cannot be completely replaced with browsing tools.