QtCreator debugger not found - c++

I am using Qt 5.1 with Visual Studio 2010. I can compile and run C++ projects with Qt, but when I try to place breakpoints and then debug, I am getting the following error:
no debugger set up
How should I set up the debugger? I would like to make it clear that I have been using Visual Studio 2010 with Qt 5.1.

From the official "Setting up Debugger" QtCreator documentation:
when using the Microsoft tool chain the Microsoft Console Debugger
CDB, is needed.
See this part of the documentation here inline as well:
Debugging tools for Windows To use this engine, you must install the Debugging tools for Windows. You can download them from Download and Install Debugging Tools for Windows. Note: Visual Studio does not include the Debugging tools needed, and therefore, you must install them separately.
The pre-built Qt SDK for Windows makes use of the library if it is present on the system. When manually building Qt Creator using the Microsoft Visual C++ Compiler, the build process checks for the required files in "%ProgramFiles%\Debugging Tools for Windows".
It is highly recommended that you add the Symbol Server provided by Microsoft to the symbol search path of the debugger. The Symbol Server provides you with debugging informaton for the operating system libraries for debugging Windows applications. For more information, see Setting the Symbol Server in Windows.
The documentation basically refers to the following MSDN url for downloading the native CDB debugger:
http://msdn.microsoft.com/en-us/windows/hardware/gg463009/
You can also set up the symbol server or Windows if you wish to go that far:
To obtain debugging information for the operating system libraries for
debugging Windows applications, add the Symbol Server provided by
Microsoft to the symbol search path of the debugger: Select Tools >
Options > Debugger > CDB. In the Symbol paths field, open the Insert
menu and select Symbol Server. Select a directory where you want to
store the cached information and click OK. Use a subfolder in a
temporary directory, such as C:\temp\symbolcache. Note: Populating the
cache might take a long time on a slow network connection. Note: The
first time you start debugging by using the Debugging tools for
Windows, Qt Creator prompts you to add the Symbol Server.

You need to install Microsoft Console Debugger (cdb) (that is part "Debugging Tools for Windows" in wdk/sdk, make sure you select it if you install the wdk/sdk or it can be found as a standalone install in the link above)

Related

How to include the ncurses.h library in C++ Visual Studio Linux Project when targeting Ubuntu on Windows?

I am trying to create a C++ console based program that will utilize the ncurses.h library. I am using Visual Studio 2017 targeting the WSL subsystem (Ubuntu).
Within ubuntu, running on my WSL, I have installed the ncurses libraries successfully.
I have created a new Project in VS. After unsuccessfully being able to get the #include to work correctly, I followed instructions on Stack to and added 'ncurses' in the Library Dependencies line under Linker / Input in the VS project properties. This enabled the application to compile the first time, and I was able to see in the Console Output that the library file was found and linked. However, VS still gives squiggly lines (errors) under all of the function names associated with the ncurses library. Also, the code does not work as expected, as the terminal appears to freeze. After running the code 2x, it appears now that the code will not build at all and I receive a strange error message that says the "program to debug does not exist on the remote system"
Can anyone please help? I've been using Visual Studio as my IDE with the WSL for school and would like to continue doing so. Future projects will be dependent on the ncurses library.
thank you for your help

Visual Studio 2017 Linux Makefile Project won't build because of chained prefix

I have a Linux project witch I developed in vim and now I'd like to go on developing it in Visual Studio with IntelliSense etc.
It's a Makefile project so I need to build it on the Linux machine.
I already created the project and created the connection and it works but I can't build because I am building with a prefix script so I open a new interactive shell with something like this
set -i
. "/tools/dist/xxxx-2010.0"/etc/profile
I don't think that visual studio can handle such thing.
Is there a way to do it?
I am calling my startprefix script with an alias then it starts the interactive shell and then I enter my make commands for usual but in visual studio it won't build it stops at t he very beginning after executing the first command (which is the startprefix alias)
And another thing is that I don't see any project files in my solution I unloaded and loaded the project but it won't get me the source files. Am I doing something wrong?
The Visual Studio C++ for Linux add-in supports MSBuild, makefile and CMake projects. If you already have the makefile then create a new Linux makefile project in VS, add in the source files and hit F5 to build.
Trying to read between the lines of your question:
C++ for Linux is optional and must be installed
thru the VS installer.
Everything, i.e editing, building, debugging, is run in VS from the
Windows host.
The source resides on the Windows host (although you can do things with shared drives if needed).
The Linux remote is just that, remote.
You might need to interact with the Linux remote to debug an
X-Windows based GUI application but console applications can be
debugged entirely on the Windows host.
If you have other commands that you need to run before and/or after the makefile then you can set these up in the VS project settings. Likewise and parameters you need to pass to make.

Find out Current Directory during Visual Studio C++ Debug session

I'm debugging C++ native application on Visual Studio 2015.
After stopping on a breakpoint, I would like to know the Current Directory. (It could have changed during the execution before stopping on that breakpoint).
On .NET debugging it is possible through the immediate window. This does not work when debugging C++ native application.
Is there a way I could find out the Current Directory when debugging C++ native application?
To make it clear - I don't want to change and build my code again. I would like to find this out in the debugger (watch window, command/immediate window etc.)
In Visual Studio 2015 there is a "C# Interactive" Window.
You can use the C# command from .NET solution you presented to get the current directory while debugging Native project.
View -> Other Windows -> C# Interactive
If you don't see this option you might want to reinstall VS2015 with C#/.NET components. (I have selected all C# related components during the install.)

Is it possible to build WinDBG extensions using Visual Studio?

To build WinDBG debugger extensions, must we use the Build utility that comes with the WDK, or can we use Visual Studio?
(In particular, I'd be interested in VS2010 SP1.)
According to the documentation of Debugging Tools for Windows, the only option should be the Build utility:
Windows Debugging | Debugger Engine and Extension API | Introduction
All debugger extensions should be compiled and built by using the
Build utility. The Build utility is included in the Windows Driver Kit
(WDK).
...but maybe the doc is not updated?
Moreover, why would the Build utility the only option for building WinDBG extensions?
What "gotchas" are hidden there?
Nothing particularly special in the case of WinDBG extensions - just build a DLL, with the right set of function names and calling convention, and off you go. So Visual Studion should be able to do that perfectly fine.
You do need to produce your own .def file for the DLL to export the functions.
This page describes how you do it using nmake. The same steps should be perfectly possible to do in VS.
http://www.codeproject.com/Articles/6522/Debug-Tutorial-Part-4-Writing-WINDBG-Extensions

How to build Qt for Visual Studio 2010

I struggled finding a how-to which provides a stable solution for using Qt with Visual Studio 2010, so after collecting all the bits of information and some trial and error, I would like to write my solution into a guide.
The problem, or why is it not possible to use prebuilt binaries?
It seems that using binaries built for Visual Studio 2008 might work in some special cases, but I found them not to work. In my case they compiled OK, but they produce runtime errors, like this:
or when started from Visual Studio 2010:
Update: I found a blog post analysing why does it work for some people, while it does not for others. In one word, it depends on whether you have Visual Studio 2008 installed on the same machine, or not.
http://blog.paulnettleship.com/2010/11/11/troubleshooting-visual-studio-2010-and-qt-4-7-integration/
The most important thing (that I stupidly didn’t realize) was the fact that you CANNOT use the Visual Studio 2008 compiled libraries and dll’s (available on the Qt webpage) if you don’t have Visual Studio 2008 installed. The reason is because the Qt SDK you download is a debug build which is dependant on the VC9.0 DebugCRT, meaning it needs the Visual C++ 2008 Debug Runtime installed, which is NOT available as a redistributable installer. The only way to install the DebugCRT is to install the entirety of Visual Studio 2008.
First of all, it’s very important to understand that for using Qt with Visual Studio 2010, it's not possible to use the pre-built binaries which were made for Visual Studio 2008, but you have to compile it from source.
Downloading Qt
On https://www.qt.io/download/
Update 2017: the latest Qt 4.x branch (Qt 4.8.6) has 2 pre-built packages, which are now in the archive section:
http://download.qt.io/archive/qt/4.8/4.8.6/qt-opensource-windows-x86-vs2010-4.8.6.exe
http://download.qt.io/archive/qt/4.8/4.8.6/qt-opensource-windows-x86-vs2008-4.8.6.exe
You should not download Qt by clicking "Qt libraries 4.8.6 for Windows (Visual Studio 2008, 218 MB)", but by clicking on the "zip" link above it.
On that link, you get a big zip file like "qt-everywhere-opensource-src-4.8.6.zip". Unzip this into a folder and make its path something nice and small, for example "E:\Qt"
Visual Studio Command Prompt
Now that we have the sources, we need to build the binaries. To do it, open the Microsoft Visual Studio 2010\Visual Studio Tools\Visual Studio Command Prompt (2010) link from your start menu, or even pin it to the taskbar (a good idea). This is a special command prompt which has all the variables set for building with Visual Studio 2010 tools.
Once within the command prompt, navigate to your extracted Qt folder using old-school DOS way, which means you have to change drive letter by E:, enter directories by cd Qt and list dir contents by dir. You can use the tab key for helping you with the directory names. When you have arrived at the correct directory, a dir command should return something like this.
Building Qt
Now it’s time for configure and build. For configuring a minimalist Qt, I'm using the following flags with configure.exe. Just copy and paste it into the command line. Look in the Qt reference manual for what flag to use or not to use.
configure.exe -release -no-webkit -no-phonon -no-phonon-backend -no-script -no-scripttools -no-qt3support -no-multimedia -no-ltcg
Once configure.exe has finished (it was 10 minutes for me), you'll need to start the build process. It will take about 20-30 minutes with the above flags. To start it, just type:
nmake
Setting environment variables
Basically, we are done. All you need to do is to set your environment variables (QTDIR and PATH), which tell programs where to find Qt. If you are on Windows 7, you can use the following command to set QTDIR to your installation dir.
setx QTDIR e:\Qt
For setting the PATH, I strongly recommend using Path Editor. Within Path Editor
add the directory of Qt\bin to your PATH
(it doesn't matter if it's in system path or user path)
If you prefer to use Control Panel\System\Environment Variables, then you can set these there, too.
Qt Visual Studio Add-in
Here you go, after a logoff-logon or a restart, all the Qt demo applications should start correctly (I recommend have a look at bin\qtdemo.exe). Now you can download and install the Visual Studio Add-in (qt-vs-addin-1.1.9.exe) from the Qt download page, it will work perfectly.
Appendix A: Official Instructions:
There is a page at the official wiki at the Qt website called Qt 4.8 Installing Qt for Windows, but I found it lacking important information.
References
Qt DevNet forums
Recommended flags for a minimalistic Qt build
Building Qt 4.5 with Visual C++ 2010
How to compile Qt as static
Qt 4.8: Configure options for Qt
Edit the PATH environment variable in
Windows without pain - op111.net
Qt V4.8.0 contains prebuilt binaries for Visual Studio 2010 so you don't need to do this anymore:
http://qt.nokia.com/downloads/windows-cpp-vs2010
Refer below link and it might be useful
1)https://www.slicer.org/slicerWiki/index.php/Documentation/Nightly/Developers/Build_Instructions/Prerequisites/Qt#Windows_3
2)http://eecs.vanderbilt.edu/research/hmtl/wp/index.php/qt-vs/