Can't see boost::optional contents when debugging with Visual Studio - c++

If I try to look at the variable directly, I see a ? sign. If I create a watch calling the is_initialized function, I get the following error:
CXX0033: Error: error in OMF type information
I didn't find much info about this error related to Boost using Google.
Anybody else experienced this? It's a hassle using OutputDebugString everywhere and rebuilding...
EDIT: Using Visual Studio 2010 SP1 with all hotfixes in Windows XP SP3 idem, and Boost 1.49.0
UPDATE: This issue comes and goes, it doesn't happen consistently; Debugger Visualizers are a great solution, I've adopted them as my brand new tool

You can use DebuggerVisualizers.

Use DebuggerVisualizers to make this transition:
Before
After
P.S. I tried to add these images to clarify the accepted answer but my edit was rejected.

Try this: for a variable boost::optional<Category> category, create a watch on: category.get()

Related

I don't see the "Publish" button. How to make standalone exe-file from C++ code?

Problem is the same as here:
Visual Studio 2017 - Not Able to see Publish - Missing Profile / Deployment Options
https://developercommunity.visualstudio.com/content/problem/129404/missing-publish-menu-in-netcore-web-project-right.html
except the fact that I didn't see the button earlier (I've started coding in Visual Studio just recently). I've installed some packages, which were adviced in mentioned topics, like "Azure" and "ASP.NET", but it didn't solve the problem. I don't understand, how it could help (I code on C++ and have not to use these packages, do I?) and what exactly I should do (maybe I've downloaded something wrong).
Thank you in advance!
Update
If I understand right, there is no way to "publish" C++ code, according to:
https://social.msdn.microsoft.com/Forums/en-US/6998eadb-36fb-4a97-bba5-0de49d533732/how-can-i-publish-a-visual-c-project-?forum=vsclassdesigner
Then, how to make standalone exe-file, that doesn't require something other like .pdb, .ipdb and .iobj and can be run on another coumputer without Visual Studio?
The command that creates the binary is called "Build".
I can't say for sure, but I think that "Debug" builds to run on another computer need vcredist, while "Release" builds can run without anything else. Again, I am not sure.

identifier "__builtin_expect" is undefined (during ROS on win tutorial-talker example)

I'm trying to do the first tutorial of ROS on Windows in Visual Studio 2015.
First I created a new WIN 32 Console application and copied the code from here.
Then I configured the project as it is described in the guide. While Debugging there came up several errors:
The identifier "__builtin_expect" is undefined in the files service_client.h and TestTalker.cpp (which is the name of my program).
Cannot open source file "sys/time.h"
The SDK from wiki.ros.org runs, I tested it.
I have no idea what's wrong.
I hope someone can help me.
Thank you in advance!!
__builtin_expect is a GCC extension. It is not provided by Visual Studio.
Since it only provides a hint to the compiler to optimize for CPU branch-prediction, one could just replace all instances of __builtin_expect(expr, c) with expr.
Or, in cases where it fits, use __assume instead, as described in this answer.

Show Environment Variable while Debugging in Visual Studio 2005?

I would like to examine the contents of an environment variable while I am debugging a C++ program in visual studio. Have googled lots but have not found the procedure to do so... any advice on how I can do this? Thanks!
None of the suggested methods worked for me... I do not know why (though I'm sure I was just missing something simple). I wound up using Process Explorer to examine the environment for the process, gave me the info I required.
Adding a watch that calls the C getenv function (e.g. getenv("PATH")) seems to work.

How to stop visual c++ stepping into certain files

Is there some way to filter what files Visual Studio 2005 (C++) steps into?
For example, when stepping into
SomeFn( a.c_str(), b.c_str(), etc );
I hate how it steps into the standard template library files for c_str() - instead I just want to go into SomeFn().
If there was some way to filter out any source files didn't live in the same path as the solution file that would make my life easier.
Does anyone know a way? Thanks
This article describes how to solve it for VC6, VC7 and VC8.
I don't know if it's in VS2005 or not (I no longer have 2005 it installed on my machine), but VS2008 has a context menu item in the debugger when you right click: "Step Into Specific"
That option will let you choose which function to step into.
The approach in VS9 is very similar to the VS8-approach described by Kirill. More details at ffuts.org

Invalid Class String Error when creating C++ Project in Visual Studio 2008 with Vista x64

After going through this Problem (connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=329986) that was related with registry permissions, now again, Visual Studio comes with another error.
I have the same error as this guy, I have searched all the internet and it seems nobody has resolved it yet.
When I create a C++ Windows Forms Application, and want to see the "Design view" of the the default Form1, it just gives me this error:
Invalid Class String (Exception from HRESULT: 0x800401F3 (CO_E_CLASSSTRING))
at Microsoft.VisualStudio.Designer.Interfaces.IVSMDCodeDomProvider.get_CodeDomProvider()
at Microsoft.VisualStudio.Shell.Design.Serialization.CodeDom.CodeDomDocDataAdapter.get_Provider()
at Microsoft.VisualStudio.Shell.Design.Serialization.CodeDom.CodeDomDocDataAdapter.get_CompileUnit()
at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager serializationManager)
at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.DeferredLoadHandler.Microsoft.VisualStudio.TextManager.Interop.IVsTextBufferDataEvents.OnLoadCompleted(Int32fReload)
I'm sorry if this has nothing to do with programming at all, but if someone has any opinions or comments, I would like to hear it.
Image at img12.imageshack.us/img12/8256/dibujowc.jpg
Sorry for the links, the system don't allow me to put hyperlinks
Well this hapend to me after i renamed feacp.dll in order to disable intellisense.
However, after re-enabling intellisense, all worked ok.