Visual Studio 2010 Watch Window? - visual-c++

I am working on a C++ code, and this is what I have in Visual Studio 2010 watch window:
I just need to understand what it means when File_Service is in [] and how to access it in my code.
When I add it to the watch window, Visual studio adds it like this: {,,Simulator.exe}*(File_Service*){*}exe
Any Help would be appreciated.

The square brackets in this case mean that the dynamic type of variable exe is File_Service. That is, your exe variable, of type unknown to me, is pointing on an object of type File_Service. Assuming exe is of type Executable, which File_Service inherits from, under that [File_Service] you'll find the variables that have been defined in File_Service.
When adding the expression in the square brackets as a member to watch, you're basically instructing the debugger to cast exe into a File_Service. This is fine in this case, but if exe will point on a different kind of Executable, that weird-looking expression won't show you anything (you can't downcast an Executable object, say, to a File_Service).

Related

Configuring VC++ for WxWidgets

I am trying to follow this guide
to configure VC++ for WxWidgets. I got stuck here.
So for Core wxWidgets libraries to include, I did include wxmsw31u[d]_core.lib and wxbase31u[d].lib under Linker>>Input>>Additional Depenedencies. That is all to it right?
As for Linking with correct runtime library, can someone tell me how that is done? I manage to get here but don't know how to set the indicated settings.
Please help. I really appreciate it.
When you want to debug your app the debugger must know where in the compiled code is each function used. In jargon, the "debugging symbols". Windows puts these symbols in the compiled executable, while Linux uses another, .devfile.
When you compile code (your app or wxWidgets library) you must tell the compiler whether you want a "Debug" version or a "Release" one.
If you want the debugger to be able to step into wxWidgets code, then you must compile wxWidgets in "debug" mode, which will add the character d to the library files built. So, you must add, for example, wxmsw31ud_core.lib to your app dependencies. Notice the d between u and _. Use the file explorer to see all files generated by wxWidgets compilation process.
Perhaps you don't want all this wxWidgets "debug". Then use another wxWidgets compilation route and add wxmsw31u_core.lib instead of the d'd version. Still you can compile your own app in debug mode, but not being able to step through wxWidgets internals.
Now for your app, a) do you want a single executable file also containing wxWidgets code? or b) let your app in a .exe file which uses as needed external .dll files?
a) is called "static linkage" while b) is called "dynamic linkage"
As you can see, there are four combinations of debug/release & static/dynamic. You must choose one "runtime library" to link to your app.
The table in the wiki shows the switch and MSVC lib (select the desired combination in the 'properties' page) to use in your app; and macro definition required to build wxWidgets if you use nmake instead of the already provided configurations in VS.
Take a look at docs\msw\install.txt for more info.
The best advice I give is that you look into "minimal" sample project. Load it into VS and read every option. You can even make a copy, change some file names and use it for your own app.
I recommend using the official instructions instead of the wiki, they're simpler and, if you look at the last paragraph, you can see that you don't even have to link the libraries manually with MSVC.
You also don't need to do anything special to link with the correct version of the CRT, the defaults are just fine.

How to make OmniPascal work with FPC?

I've installed both FreePascal compiler and OmniPascal extension for VisualStudio code, but code completion doesn't work. In the manual you are saying that I need to write the path to Delphi compiler int the user settings, but nothing is said about FPC.
Set the omnipascal.freePascalSourcePath setting to the folder that contains the FreePascal sources
Set the omnipascal.defaultDevelopmentEnvironment setting to FreePascal
Restart Visual Studio Code.
Example:
"omnipascal.freePascalSourcePath": "C:\\lazarus\\fpc"
"omnipascal.defaultDevelopmentEnvironment": "FreePascal"
This will instruct the OmniPascal language server to lookup Pascal units (.pas and .pp files) in that directory and all its subtrees recursively.

How to debug input method editor DLL in VS2011 on Windows 8?

I'm trying to debug an input method editor (IME) application. In order to run this sampleIme application DLL file generated, I must move the generated DLL file to windows\system32 directory and Register the generated dll file, Ime add in to the language bar.
How to debug input method editor DLL in VS2011 Windows 8?
I am not sure if this is possible, but a reasonably good workaround is to add code to your Visual Studio project to write variable values to a text file at points and times of interest.

visual c++ - check through what chain of #includes a type gets declared

is there a way in visual studio to select some type and display how it gets included into the current file?
for example i'd like to click on some membervariable
SomeType a;
and then get displayed something like "first_include.h"->"second_include.h"->"SomeType.h"
to understand what chain of includes the compiler uses to take the declaration of the variable SomeType.
Thanks!
Try the "show includes" option in C/C++->"Advanced Project Settings".
EDIT:
"Show includes" will display all the files that are includes from a particular file. Include files shown will be indented according to the level at which they are included. Use "go to definition" to find which file has the definition and then simply look for the hierarchy of includes which leads to that file.

C++ ODBC problem with sqlucode.h header

I found a great C++/ODBC example here...
The project I downloaded builds great and everything works. However, when I copy the .cpp and .h files into another project, I seem to have a linking problem.
The SQLConnect function in sql.h is the one I want. When I right-click this function in the easyodbc.h file in the project I downloaded, it jumps to the declaration in sql.h. Life is good.
However, in the project I created, when I do this it jumps to a UNICODE definition in sqlucode.h. This seems to be causing problems and my test project crashes.
I don't have an #include for sqlucdode.h anywhere in my project, yet it still resolves the declaration to the one in sqlucode.h. How can I prevent this? Thanks.
Seems like you have a preprocessor problem rather than a linking problem.
You probably have a preprocessor definition for UNICODE (or _UNICODE) in your project file. In Visual C++ 2005 and 2008 you can fix this by going to your project properties and changing Character Set from Use Unicode Character Set to Use Multi-Byte Character Set. When you apply this setting, Visual Studio fixes up the right preprocessor and linker settings for you.
If you have an earlier version of Visual Studio you can still fix it by changing the preprocessor definitions for UNICODE and _UNICODE to _MBCS - it's just you'll have to find them yourself.
EDIT: I just downloaded that example code and tried it - good news, it's exactly as I guessed, change to a multibyte character set and you'll be fine.

Resources