Questions tagged [visual-c++-2012]

The version of Visual C++ bundled with Visual Studio 2012, released in August 2012. Also known as VC++11, or VC11, based on C++ compiler version 17.0. Do not use this tag unless you have a specific question about this specific version.

The version of Microsoft Visual C++, a C and C++ compiler for Windows (released on August 15th, 2012).

Resources:

See for more information.

122 questions
102
votes
3 answers

Explicit Return Type of Lambda

When I try and compile this code (VS2010) I am getting the following error: error C3499: a lambda that has been specified to have a void return type cannot return a value void DataFile::removeComments() { string::const_iterator start, end; …
Ryan
  • 5,504
  • 7
  • 34
  • 51
94
votes
7 answers

C++11 features in Visual Studio 2012

A preview version of Visual Studio 2012 (the next version after VS2010) is now available. Does anyone know what new C++11 features it supports? (I'm not in a position to try it out at the moment).
HighCommander4
  • 44,537
  • 22
  • 112
  • 180
40
votes
7 answers

fastest way to negate a number

I was thinking this morning here, what would be the fastest way to reverse a number of positive to negative and from negative to positive, of course, the simplest way might be: int a = 10; a = a*(-1); or int a = 10; a = -a; But then, I thought, I…
Alexandre
  • 1,805
  • 1
  • 26
  • 52
29
votes
2 answers

Possible compiler bug in Visual C++ 2012 (x86)?

I'm currently experiencing random floating point errors when compiling for x86 targets using VC++ 11 (CTP Update 1). See the short example "test.cpp" below, and compile using: cl /GL /O2 /EHsc test.cpp /link /MACHINE:X86 The output should be 10 ==…
25
votes
5 answers

std::thread::join() hangs if called after main() exits when using VS2012 RC

The following example runs successfully (i.e. doesn't hang) if compiled using Clang 3.2 or GCC 4.7 on Ubuntu 12.04, but hangs if I compile using VS11 Beta or VS2012 RC. #include #include #include #include…
Fraser
  • 65,864
  • 15
  • 215
  • 204
16
votes
3 answers

Resolving Error R6016 - Not enough space for thread data

My statically-linked Visual C++ 2012 program sporadically generates a CRTL error: "R6016 - Not enough space for thread data". The minimal documentation from Microsoft says this error message is generated when a new thread is spawned, but not enough…
Dev93
  • 538
  • 1
  • 4
  • 18
13
votes
1 answer

Variadic Template in VS 2012 (Visual C++ November 2012 CTP)

I installed Visual C++ Compiler November 2012 CTP and created a C++ console project. I wrote this in template void Test(T value){ } template void Test(T value, Args... args){ Test(value); …
user34537
12
votes
2 answers

Do C++ lambdas not correctly select overloaded functions?

I've got an function that iterates over a container and passes each element to a predicate for filtering. An overload of this function also passes the index of each element into the predicate. template void…
moswald
  • 10,845
  • 4
  • 47
  • 74
12
votes
2 answers

Where is the loop-carried dependency here?

Does anyone see anything obvious about the loop code below that I'm not seeing as to why this cannot be auto-vectorized by VS2012's C++ compiler? All the compiler gives me is info C5002: loop not vectorized due to reason '1200' when I use the…
12
votes
3 answers

Can a member of a class be named the same name as its type (another class)?

Trying to compile the following code on different compilers gives me two different results: struct S{}; struct T{S S;}; int main(){} As you can see, inside T, I have an object named the same as the previously defined class S. On GCC 4.7.2, I get…
chris
  • 55,166
  • 13
  • 130
  • 185
10
votes
3 answers

Why std::string concatenation operator works like right-associative one?

Running the following MWE extracted from my pet project and compiled with GCC 4.9.1 (and 4.8.1 also) #include #include #include class InputStringStream { public: InputStringStream(const std::string& str) :…
Wildcat
  • 8,366
  • 6
  • 37
  • 60
10
votes
1 answer

Why does this template code work in VS2010, but not in VS2012?

I have inherited a project making heavy use of template meta programming, and am now in the process of upgrading from Visual Studio 2010 to 2012. Some of the template-code no longer works in 2012. I have distilled a minimal example: template…
knatten
  • 4,906
  • 3
  • 18
  • 26
10
votes
1 answer

C++11 filesystem (VS2012)

I am having a lot of trouble finding any documentation on the header included with vs2012. I see that it is mentioned here but they don't provide a link on how to use it. What I am really looking for is documentation for how to use it, with the…
Mranz
  • 1,240
  • 1
  • 12
  • 19
9
votes
6 answers

Compile C app with Visual Studio 2012

I plan to write application in C using Microsoft Visual Studio 2012. The problem is that I can't find a way to compile it right in the editor. I found this solution http://msdn.microsoft.com/en-us/library/bb384838.aspx but I dont like it. Can you…
9
votes
2 answers

Profiling with CMake, C++, and Visual Studio 2012

I am using CMake 2.8.10.1 to generate project files for Visual Studio 2012 Ultimate (64-bit). The resulting solution contains a library, some tests, and some executables. I would like to profile some of the applications. When I select "ANALYZE" ->…
Petter
  • 33,328
  • 6
  • 42
  • 59
1
2 3
8 9