All Questions
Tagged with c++ visual-studio
15,310
questions
604
votes
14
answers
538k
views
Debugging with command-line parameters in Visual Studio
I'm developing a C++ command-line application in Visual Studio and need to debug it with command-line arguments. At the moment I just run the generated EXE file with the arguments I need (like this ...
286
votes
5
answers
224k
views
View array in Visual Studio debugger? [duplicate]
Is it possible to view an array in the Visual Studio debugger? QuickWatch only shows the first element of the array.
280
votes
7
answers
204k
views
How to Detect if I'm Compiling Code with a particular Visual Studio version?
Is there any way to know if I'm compiling under a specific Microsoft Visual Studio version?
239
votes
7
answers
1.0m
views
Remove secure warnings (_CRT_SECURE_NO_WARNINGS) from projects by default in Visual Studio
Is there a way to set by default for all projects removing the precompiler secure warnings that come up when using functions like scanf(). I found that you can do it by adding a line in the project ...
222
votes
31
answers
729k
views
Unresolved external symbol in object files [duplicate]
During coding in Visual Studio I got an unresolved external symbol error
and I've got no idea what to do. I don't know what's wrong.
Could you please decipher me? Where should I be looking for what ...
197
votes
10
answers
92k
views
Displaying the #include hierarchy for a C++ file in Visual Studio
Problem: I have a large Visual C++ project that I'm trying to migrate to Visual Studio 2010. It's a huge mix of stuff from various sources and of various ages. I'm getting problems because something ...
197
votes
6
answers
272k
views
How to enable C++17 compiling in Visual Studio?
I want to use C++17 features.
How can I switch compiling from C++14 to C++17 in Microsoft Visual Studio?
Or is it not available in release versions of VS?
193
votes
14
answers
194k
views
How to fix .pch file missing on build?
When I build my c++ solution in Visual Studio it complains that the xxxxx.pch file is missing. Is there a setting I am missing to get the pre-compiled headers back?
here is the exact error for ...
186
votes
4
answers
68k
views
Should I add .vcxproj.filter files to source control?
While evaluating Visual Studio 2010 Beta 2, I see that in the converted directory, my vcproj files became vcxproj files. There are also vcxproj.filter files alongside each project which appear to ...
182
votes
23
answers
592k
views
CMake error at CMakeLists.txt:30 (project): No CMAKE_C_COMPILER could be found
I'm trying make a Visual Studio solution with CMake to compile the latest version of aseprite and CMake keeps giving me the:
No CMAKE_C_COMPILER could be found.
No CMAKE_CXX_COMPILER could be found.
...
163
votes
13
answers
275k
views
error LNK2019: unresolved external symbol _WinMain@16 referenced in function ___tmainCRTStartup
While I am running the simple code as below I have two errors as following:
#include <iostream>
#include <string>
using namespace::std;
template <class Type>
class Stack
{
public:
...
163
votes
15
answers
178k
views
Fatal error: "No Target Architecture" in Visual Studio
When I try to compile my c++ project using Visual Studio 2010 in either Win32 or x64 mode I get the following error:
>C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\winnt.h(135): ...
160
votes
9
answers
149k
views
Cannot open include file 'afxres.h' in VC2010 Express
I'm trying to compile an old project using VS express 2010 but I get this error:
fatal error RC1015: cannot open include file 'afxres.h'. from this code
////////////////////////////////////////////...
158
votes
9
answers
71k
views
How to display a dynamically allocated array in the Visual Studio debugger?
If you have a statically allocated array, the Visual Studio debugger can easily display all of the array elements. However, if you have an array allocated dynamically and pointed to by a pointer, it ...
152
votes
7
answers
112k
views
Should I compile with /MD or /MT?
In Visual Studio, there's the compile flags /MD and /MT which let you choose which kind of C runtime library you want.
I understand the difference in implementation, but I'm still not sure which one ...
144
votes
3
answers
78k
views
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 ...
138
votes
6
answers
234k
views
How do I use CMake?
I am trying to use CMake in order to compile opencv.
I am reading the tutorial but can't understand what is CMakeLists files and how is it connected to the gui of CMake?
Also couldn't understand ...
136
votes
9
answers
206k
views
How to enable C++17 in CMake
I'm using VS 15.3, which supports integrated CMake 3.8. How can I target C++17 without writing flags for each specific compilers? My current global settings don't work:
# https://cmake.org/cmake/help/...
136
votes
4
answers
170k
views
How do I make a fully statically linked .exe with Visual Studio Express 2005?
My current preferred C++ environment is the free and largely excellent Microsoft Visual Studio 2005 Express edition. From time to time I have sent release .exe files to other people with pleasing ...
135
votes
5
answers
126k
views
How can I make Visual Studio's build be very verbose?
I need to get a hold of every flag, every switch used in the build process by the Visual Studio binaries. I tried to obtain a verbose output by using vcbuild, but I wasn't able.
What do I have to do ...
135
votes
13
answers
179k
views
Cannot find Dumpbin.exe
I do not see dumpbin.exe on my system. I have Visual Studio 2005 on my system. When I type dumpbin on the command line, it says unrecognizable command.
Does it come with Visual Studio by default, or ...
129
votes
6
answers
164k
views
How to #include header files from other projects from the same solution
I am working on a game using Visual C++. I have some components in separate projects, and have set the project dependencies. How do I #include a header file from a different project? I have no idea ...
125
votes
13
answers
221k
views
How to fix the error "Windows SDK version 8.1" was not found?
I recently updated visual studio 2015 and now, when i try to build any project it always fails and i get the error
Severity Code Description Project File Line Suppression State
...
122
votes
4
answers
64k
views
What is the difference between "Include Directories" and "Additional Include Directories"
In configuration properties of my project, under the "VC++ directories" there is an entry for "Include Directories". But under "C/C++" option, there is another entry called "Additional Include ...
121
votes
12
answers
97k
views
Using pre-compiled headers with CMake
I have seen a few (old) posts on the 'net about hacking together some support for pre-compiled headers in CMake. They all seem a bit all-over the place and everyone has their own way of doing it. What ...
120
votes
8
answers
187k
views
M_PI works with math.h but not with cmath in Visual Studio
I am using Visual Studio 2010. I have read that in C++ it is better to use <cmath> rather than <math.h>.
But in the program I am trying to write (Win32 console application, empty project)...
119
votes
7
answers
147k
views
C99 stdint.h header and MS Visual Studio
To my amazement I just discovered that the C99 stdint.h is missing from MS Visual Studio 2003 upwards. I'm sure they have their reasons, but does anyone know where I can download a copy? Without ...
114
votes
7
answers
367k
views
Where does Visual Studio look for C++ header files?
I checked out a copy of a C++ application from SourceForge (HoboCopy, if you're curious) and tried to compile it.
Visual Studio tells me that it can't find a particular header file. I found the file ...
113
votes
10
answers
261k
views
How do I print to the debug output window in a Win32 app?
I've got a win32 project that I've loaded into Visual Studio 2005. I'd like to be able to print things to the Visual Studio output window, but I can't for the life of me work out how. I've tried '...
109
votes
7
answers
172k
views
Using CMake to generate Visual Studio C++ project files
I am working on an open source C++ project, for code that compiles on Linux and Windows. I use CMake to build the code on Linux. For ease of development setup and political reasons, I must stick to ...
103
votes
12
answers
207k
views
fatal error LNK1104: cannot open file 'libboost_system-vc110-mt-gd-1_51.lib'
Seem I can't get this to work. I made a simple console application (which depend on websocket++ library) which need Boost libraries.. but when I try to compile I get:
fatal error LNK1104: cannot ...
103
votes
12
answers
66k
views
Visual Studio support for new C / C++ standards?
I keep reading about C99 and C++11 and all these totally sweet things that are getting added to the language standard that might be nice to use someday. However, we currently languish in the land of ...
102
votes
2
answers
40k
views
What are ALL_BUILD and ZERO_CHECK and do I need them?
I've created a simple CMakeLists.txt:
cmake_minimum_required(VERSION 2.8)
project (HelloWorld)
add_executable (HelloWorld main.cpp)
When I generate a VS2012 or VS2010 project from CMake, however, I ...
94
votes
5
answers
113k
views
module unsafe for SAFESEH image C++
I am using Microsoft Visual Studio 2011 Professional Beta
I am trying to run the OpenCV C++ files (http://opencv.willowgarage.com/wiki/Welcome) that I have compiled using cMake & the Visual ...
93
votes
5
answers
411k
views
How to declare a global variable in C++
I know one should not use global variables but I have a need for them. I have read that any variable declared outside a function is a global variable. I have done so, but in another *.cpp file, that ...
93
votes
20
answers
302k
views
Visual Studio: LINK : fatal error LNK1181: cannot open input file
I've been encountering a strange bug in Visual Studio 2010 for some time now.
I have a solution consisting of a project which compiles to a static library, and another project which is really simple ...
87
votes
7
answers
99k
views
Export all symbols when creating a DLL
With VS2005, I want to create a DLL and automatically export all symbols without adding __declspec(dllexport) everywhere, and without hand-creating .def files. Is there a way to do this?
84
votes
11
answers
48k
views
Visual Studio 2010's strange "warning LNK4042"
I've just been beaten (rather hardly) on the head by some non-trivial warning from Visual Studio 2010 (C++).
The compilation gave the following output:
1 Debug\is.obj : warning LNK4042: object ...
84
votes
10
answers
55k
views
How to detect whether there is a specific member variable in class?
For creating algorithm template function I need to know whether x or X (and y or Y) in class that is template argument. It may by useful when using my function for MFC CPoint class or GDI+ PointF ...
84
votes
6
answers
261k
views
How do I use a third-party DLL file in Visual Studio C++?
I understand that I need to use LoadLibrary(). But what other steps do I need to take in order to use a third-party DLL file?
I simply jumped into C++ and this is the only part that I do not get (as ...
84
votes
6
answers
69k
views
How to set up Google C++ Testing Framework (gtest) with Visual Studio 2005
It is not documented on the web site and people seem to be having problems setting up the framework. Can someone please show a step-by-step introduction for a sample project setup?
84
votes
4
answers
152k
views
How do I build an import library (.lib) AND a DLL in Visual C++?
I want to have a single Visual Studio project that builds a DLL file and an import library (.lib) file. (An import library is a statically-linked library that takes care of loading that DLL file in ...
83
votes
5
answers
82k
views
pinvokestackimbalance -- how can I fix this or turn it off?
I just switched to vs2010 from vs2008. Exact same solution, except now every single call to a C++ dll yields a 'pinvokestackimbalance' exception.
This exception does not get fired in 2008. I have ...
83
votes
2
answers
31k
views
What is Security Development Lifecycle Checks option in Visual Studio?
I am using Visual Studio 2013 Preview, although I'm sure I've seen it in earlier versions. When creating a new project using the wizard, I select C++, Win32 Console Application, and there is an option ...
82
votes
6
answers
32k
views
#include all .cpp files into a single compilation unit?
I recently had cause to work with some Visual Studio C++ projects with the usual Debug and Release configurations, but also 'Release All' and 'Debug All', which I had never seen before.
It turns out ...
82
votes
2
answers
32k
views
What is the difference between the /Ox and /O2 compiler options?
Microsoft's C++ compiler (cl.exe, as included with Visual Studio) offers several optimization switches. The difference between most of them seems self-explanatory, but it's not clear to me what the ...
80
votes
10
answers
250k
views
Visual Studio /**/ comment shortcut?
I want to know how to put the /**/ comments through shortcut. I know the Ctrl+K+C shortcut for the // comments but it comments the whole line. Sometimes while debugging, I want to do something like "...
78
votes
11
answers
43k
views
Why is Visual C++ lacking refactor functionality?
When programming in C++ in Visual Studio 2008, why is there no functionality like that seen in the refactor menu when using C#?
I use Rename constantly and you really miss it when it's not there. I'm ...
76
votes
10
answers
167k
views
Disabling Warnings generated via _CRT_SECURE_NO_DEPRECATE
What is the best way to disable the warnings generated via _CRT_SECURE_NO_DEPRECATE that allows them to be reinstated with ease and will work across Visual Studio versions?
76
votes
9
answers
27k
views
Useful Add-Ins or Plug-Ins for native Visual Studio developer [closed]
There are plenty of different Add-Ins for Visual Studio see Visual Studio Gallery
. Please share your experiences and favorites.
As motivation, here are some of my favorites:
Versioning Controlled ...