How to update MFC source code? - c++

After several Visual Studio patches and a service pack or two, my MFC source code no longer matches my MFC binaries. When I trace into MFC, I either see assembly or old source code.
How do I get my MFC sources to match my binaries again?

Since there are no other answers I'll tell you the obvious (and the most painful) one. Reinstall everything. And if possible install Visual Studio with SP slipstreamed.
Although I don't know what you meant by "old source", I don't think there were any changes to MFC between Visual Studio 2005 and SP1. But I might be mistaking.

I'm not sure why it's not picking it up automatically - when you build a dll, the source location is stamped in the pdb. Anyway, try setting the source file path in Visual Studio to first point to the "updated" MFC source. If that doesn't work, step into the MFC function again (so you get the "incorrect" source), then close out that file, then browse to and open the "correct" source file. See if the debugger jumps to the appropriate location then.

There are a number of updates from the MS download centre, searching MFC. but the only one mentioning source is the OLEUI2.cpp update to VS.Net 2003. Maybe it hasn't actually been changed but does need recompiling?

Related

Cannot associate .hpp, .cpp extensions with visual studio 2017RC in Windows 10

You know my question. Here is the longer version. Downloaded 2017RC, it took me a day to set it up to work with UCRT, CMake, Google test and all the goodies. Then I tried to associate the usual hpp, h, cpp extensions two ways:
Control panel -> Default Programs -> Set Default Programs, choose Visual Studio 2017RC and then -> Set Program Associations where all the possible extensions that can be handled by this program are listed. None of the usual C++ extensions are listed.
Right click on a .cpp file, Open with, visual studio 2017 RC doesn't show up in the apps list, hunt it down and click on it. A dialog box pops up saying that The program you have chosen cannot be associated with this file type.
FYI, currently all the c, C++ extensions are associated with Qt. Am I to think that RCs are not expected to have this feature? Or is it some other sub-program within VS, with which the association should be made? Thanks for your help
I had the same problem for Visual Studio 2015. The answer here is a good starting point:
https://superuser.com/questions/977271/windows-10-visual-studio-2015-xaml-file-association
Specifically, modifying "HKEY_CLASSES_ROOT.cpp". I changed the (Default) String value to VisualStudio.cs.14.0 and it now opens .cpp files in Visual Studio 2015.
You would have to use whatever version Microsoft has for Visual Studio 17. Take a look at an existing working file extension to see what it uses.
As usual, backup everything before messing around in the Windows registry.
For what it's worth, Microsoft appears to have fixed this bug, and will apparently be releasing the fix in the next release:
https://developercommunity.visualstudio.com/content/problem/3122/vc-file-association-not-correct.html

Visual Studio 2015 (C++) : Stop compile on first build error (not first project)

How to stop the compilation of Visual Studio 2015 when it detects compile error?
I mean first build error (may be first .cpp), not first project because it takes too much time.
(I have only 1 project.)
An extension named "StopOnFirstBuildError" is not an answer,
because it stop on first project that has error.
Question
(more elaborate)
When I pressed F5 or Ctrl+Shift+B, the compiler would compile all (or some) files.
In my case, it can detect some errors using only 5 seconds, so I want it to stop compiling NOW.
However, the VS 2015 become non-responsive.
It also has strong resistance against Ctrl+Break.
It takes about 30 seconds before I can navigate to the location of error.
How can I stop the compile-process on the first compile error automatically?
History
There is an old thread asked about this for Visual Studio 2008.
Its most accepted solution is to go to :-
Visual Studio -> Tools -> Macros -> Macro IDE... (or ALT+F11)
and paste a certain piece of code.
However, macro is not supported anymore in VS 2012.
(I tried to press Alt+F11 in VS 2015, no macro editor / menu appear.)
The claim is consistent with a question for VS 2010 stated that the above trick is not work.
The solution for the VS2010 question is to install an extension named "CancelFailedBuild".
Thus, I downloaded it.
When executed .vsix (the installer), it said
"This extension is not installable on any currently installed products.".
... it makes sense because the extension said "Works with : Visual Studio 2010, 2012".
Now I think I am left with a single choice :-
Use macro (the old VS 2008 way) by installing Macros extension.
(The extension is a result of users' complain about losing the old macro feature.)
Is downloading the extension a good idea?
If so, what is the step after that? Is there a code that I should copy-paste?
If not, what is the easier way?
Sorry for posting a lot of hyperlinks.
Workaround
Below are the approaches that may alleviate some inconvenience, but do not answer the actual question at all.
Install a patch that make Visual Studio responsive, so Ctrl+Break works.
It requires me to press keyboard manually.
It seems to work only for Windows 7. (not tested)
Shorten compile time by creating a simple dummy .cpp, then compiling only that single file.
It is useful for some cases.
The solution for the VS2010 question is to install an extension named "CancelFailedBuild".
...
This extension is not installable on any currently installed products.
...it makes sense because the extension said that "Works with: Visual Studio 2010, 2012."
Visual Studio 2012 extensions are frequently compatible with VS2013 and VS2015. You can update the extension yourself by unzipping the .vsix file (it's just a ZIP archive) and updating its manifest (which is an XML file).
This guide shows you the XML elements to change.

MSVCR100D.dll error at runtime

Ok , so i created a program using VC++ 2010. it ran just fine.
Got to work and could only install vc++ 8 due to having a crappy computer that is still stuck on xp sp2...
Everything will link up and build with no errors, But when the program starts to run i get "This application has failed to start because MSVCR100D.dll was not found"
I tried changing the runtime libary from MDd to MTd but still no luck...any idea?
That DLL comes with Visual Studio 2010. If you want to use your program, you'll somehow have to get your hands on it. If possible at your work, you can download it. Another (probably better) option would be to take it with you from home on a USB drive.
Edit: You can also try re-creating the project, and then copying the source code over into the new project. Your newly created project (in Visual Studio 2008) should not be depending on that erroneous DLL.
Edit 2: As Hans Passant added in a comment, this DLL is needed by Debug compilations of your program. So if you simply compile as Release, you can safely ignore the first part of my post. (I hope I'm not breaking gentleman rules by adding this to my post.)
MSVCR100D.dll is for debug mode, and is installed with visual studio 2010, since 2008 has MSVCR80D. You can just google that and download it, and put it in the same direcrory, or just complie in release mode.
here is a download link. You need the small download zip file button, not the big ones.
http://www.dll-files.com/dllindex/dll-files.shtml?msvcr100d
As I know, MSVCR100D is debug version of runtime library used by VC2010。So, if your point either is:
(1) you do not have that dll which you really need, you can download at http://www.dll-files.com/dllindex/dll-files.shtml?msvcr100d or
(2) you want to run that program without requirement of MSVCR100/D.dll, you may need to recreate a project in VC8, then substitute with your source files (not solution file or other files managed by Vistual Studio).
FYI: If my memory were not going wrong, I remember that a project created by higher version of VS cannot be opened directly by lower version one. So, how did you build them?

C++ OpenCV Source

I have downloaded OpenCV. I have got the demos working but what I really want to do is step throuh the source code and see what is going on.
In C# I download source code and set it up so that I can step through it but I do not know how to do this or even if it is possible in C++. I do not even know how to set the source code up so that I can right click on a method name and then click go to definition.
Is it possible to do the same things with source code in C++ as in C#, if so how do I do this?
I'm assuming you want the IDE to show the source code while debugging, or when you click something like "go to declaration" or "follow object under cursor". You will need to tell the IDE where to find the source code.
The Windows OpenCV installer includes the source code, so if you want to locate it manually, check where the installer installs its magic. In Visual Studio, you can add source directories to the Environment in Preferences.
You need to download OpenCV 2.2 for Windows (with VS 2010 project).
OpenCV-2.2.0-win32-vs2010.exe
installation package containing OpenCV source code,
documentation, samples and pre-compiled
32-bit binaries for Visual Studio 2010 developers.
It does not contain 64-bit binaries, binaries
for other compilers, such as VS2008 or MinGW.
It does not have TBB or IPP support built-in.
If you need those, reconfigure and rebuild OpenCV from the source code

Visual Studio: Intellisense Problems and Linux Compatibility

Two somewhat unrelated questions:
Sometimes when I am working on a C++ project in Visual Studio 2008 Express, intellisense just does not want to "work" even though it really should. Auto completion box does not show and status bar says something along the lines of: "Intellisense: No further information is available".
Sometimes it can be fixed by either rebuilding the solution or re-opening the solution, and sometimes even that doesn't work. Is this a known problem? If so: are there any known fixes?
Is there any C++ IDE for Linux that has compatibility with MSVC++'s .sln files? I sometimes want to work on some project without having to go through the hassle of creating a new project and adding the files or manually creating a Make file.
edit:
To answer my own questions:
Apparently there's no real fix other than to try and delete the .ncb file. Alternative would be a different IDE or to use a commercial package replacing intellisense.
Code::Blocks seems to be able to open Visual Studio files. Or at least import them easily.
I posted these together as they both related to visual studio and I didn't deem them important enough to both deserve their own topic.
Do think the downvote is a little harsh though!
Intellisense failing is usually because of a "corrupt" ncb file. The usual solution is to delete it.
Reportly the next version VS 2010 will not be using ncb files anymore.
I've actually had some luckk opening .sln files using Monodevelop.
To avoid creating the Make files by hand try CMake
To answer your second question, there is no way to open .sln files in anything other than Visual Studio. They're a proprietary file type that (it seems) no one has any interest in writing a parser for.
You can however use Visual Studio to generate a makefile automatically. Just use the "Projects > Export Makefile" menu command in Visual Studio.