Microsoft Studio Visual C++ 2013 (MSVC 12.0) is a commercial (free version available), integrated development environment (IDE) product from Microsoft for the C, C++, and C++/CLI programming languages.
Questions tagged [msvc12]
139 questions
23
votes
4 answers
C++, curious compiler error when implementing a function `int next(std::string param)`
I've been badly bitten by the following code, on which I wasted many hours of precious time.
#include
int next(std::string param){
return 0;
}
void foo(){
next(std::string{ "abc" });
}
This produces the following compiler error…

Ray
- 7,833
- 13
- 57
- 91
14
votes
2 answers
"Function has no address" despite disabled optimization (/Od)
During debug in MSVC 2012, I am attempting to call some functions from the Watch window in order to dump data to files. However, I keep getting this error:
Function Matrix::Save has no address, possibly due to compiler optimizations.
The class…

Anton Poznyakovskiy
- 2,109
- 1
- 20
- 38
13
votes
3 answers
Can't assign string literal to boxed std::string vector
This is a simplified version of my type system:
#include
#include
template
class Box {
public:
Box(const T& value) : _value(value) {};
private:
T _value;
/* ... */
};
typedef Box Int;
typedef…

PhilLab
- 4,777
- 1
- 25
- 77
13
votes
3 answers
How to fix 'error MSB4018: The "VCMessage" task failed unexpectedly' in Visual Studio 2013
This is what I see:
1>------ Build started: Project: xxx (xxx\xxx), Configuration: Debug Win32 ------
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.Cpp.Platform.targets(64,5): error MSB4018: The "VCMessage" task failed…

Ger Hobbelt
- 1,126
- 1
- 11
- 16
11
votes
2 answers
Why does is_copy_constructible return true for unique_ptr in MSVC12
I would have expected this static assertion to fire:
#include
#include
int main() {
static_assert(std::is_copy_constructible>::value, "UPtr has copy constructor?");
}
But it does not.
Compiled using…

sji
- 1,877
- 1
- 13
- 28
11
votes
1 answer
Possible compiler bug in MSVC12 (VS2013) with designated initializer
Using VS2013 Update 2, I've stumbled on some strange error message :
// test.c
int main(void)
{
struct foo {
int i;
float f;
};
struct bar {
unsigned u;
struct foo foo;
double d;
};
…

diapir
- 2,872
- 1
- 19
- 26
9
votes
1 answer
How does std::promise store const types in MSVC, GCC, and Clang?
Recently, I've started using MSVC to compile a code which was always compiled with GCC and Clang. Some piece of this code produces an interesting compilation error (truncated):
C:/data/msvc/14.33.31424-Pre/include\future(311) error C2678: binary…

Eugene Kuznetsov
- 91
- 2
9
votes
1 answer
Whats the design rationale between GCC exporting all symbols by default vs MSVC not exporting anything by default?
One of the many key differences between C++ Compilers GCC & MSVC is that in the first all symbols from a shared library are exported by default, while MSVC exports nothing.
Some implications are that in, In MSVC, you have to export explict…

Fernando Gonzalez Sanchez
- 3,315
- 4
- 32
- 45
8
votes
3 answers
Where is MSVC installed? - Detecting location of `cl.exe` and `link.exe`
I remember in the ol' days getting people to run vcvarsall.bat before compiling anything on Windows. Assuming default install location, where do I find cl.exe, link.exe, and friends; if it's not in the PATH?
Attempt:
#include
#include…

Samuel Marks
- 1,611
- 1
- 20
- 25
8
votes
2 answers
Delphi: Calling a C dll function with Debugger takes 15 s without debugger 0.16 s. Why?
I have the following setup:
A Delphi command line application written in Delphi XE5 and built in Debug 64 bit.
A C dll written in Microsoft Visual Studio 2013 and built in Release 64 bit.
The Delphi command line application calls a function in the…

denim
- 1,329
- 1
- 15
- 24
6
votes
2 answers
MSVC Address Sanitizer - Any reason to use it in Release builds?
Microsoft recently brought Address Sanitizer (ASan) to Microsoft Visual Studio 2019, and I've been experimenting with it. This question is specific to C and C++. My question is this: Is there any reason to have ASan enabled for Release builds, as…

Ryan Ries
- 2,381
- 1
- 24
- 33
6
votes
3 answers
Error C2491: definition of dllimport function not allowed
I have a problem with make a dll on Visual Studio 2013. This code works on Code::Blocks. The error was definition of dllimport function not allowed" on line void DLL_EXPORT prim(map> nodes, map, pair

pawel112
- 111
- 1
- 1
- 8
6
votes
4 answers
std::thread cause deadlock in DLLMain
So, this is what I'm talking about: std is complex.
In VS2013 this simple program will cause a deadlock.
#include
#include
void foo()
{
}
void initialize()
{
std::thread t(foo);
}
BOOL APIENTRY DllMain(HMODULE, DWORD…

amanjiang
- 1,213
- 14
- 33
6
votes
7 answers
Exit application while stdin blocking on windows
I have an application, which reads data from standard input using getline() in a thread. I want to close the application from the main thread, while getline still block the other thread. How can this be achieved?
I don't want to force the users to…

simon
- 1,210
- 12
- 26
6
votes
1 answer
2>LINK : fatal error LNK1104: cannot open file 'libboost_filesystem-vc120-mt-sgd-1_58.lib'
And no wonder as there is no such file in ...\boost_1_58_0\stage\lib. How can I get one ? I only have:
boost_1_58_0\stage\lib\libboost_filesystem-vc120-mt-s-1_58.lib
boost_1_58_0\stage\lib\libboost_filesystem-vc120-s-1_58.lib
in there. Tried to…

Mr_and_Mrs_D
- 32,208
- 39
- 178
- 361