visual-c++-2012

Using DLL in debug or release mode?

一曲冷凌霜 提交于 2019-12-13 04:59:24
问题 I downloaded a precompiled SQLite DLL from http://www.sqlite.org at this link sqlite-dll-win32-x86-3080600.zip. Can I use the same DLL both in Debug and Release mode? What would be the difference and how is it possible? I'm using Visual C++ 2012 Compiler. 回答1: For the DLL internals to be visible in debug mode, it has to be compiled in debug mode. Otherwise, no debug info will be available (e.g. watch variables, step into, etc.). On the other hand, a DLL compiled in debug mode shouldn't be

How do I change the number of template arguments supported by MSVC++'s std::tuple?

人盡茶涼 提交于 2019-12-11 01:06:47
问题 MSVC++ doesn't yet support variadic templates, so its standard library "fakes" these for classes like std::tuple through use of macros. I recently tried compiling one of my projects with the VC11 beta, and got this to show for it: gtest\gtest.h(9735): error C2977: 'std::tuple' : too many template arguments c:\program files (x86)\microsoft visual studio 11.0\vc\include\utility(72) : see declaration of 'std::tuple' gtest\gtest.h(9743): error C2977: 'std::tuple' : too many template arguments

Mixing VS2012 Platform Toolsets

房东的猫 提交于 2019-12-10 17:57:29
问题 We are in the process pf switching from VS2005 to VS2012 update 2. We are building a large number of (mostly console) native C++ (no MFC/ATL) executables that use a couple of common, statically linked libraries. These executables mostly run on Win7 machines but some are also deployed on older XP machines (or the corresponding server versions). Most executables are 32-bit but some are 64-bit. My questions are as follows: 1) What are the drawbacks, if any, to building all the executables and

std::thread class in VC++ 11 causes random crashes. Any workarounds?

一笑奈何 提交于 2019-12-10 13:52:58
问题 I've encounter a bug in Visual Studio 11 Developer Preview, at least I think it is a bug and reported it, but I'm interested whether someone know a workaround. When I use std::thread class to create more then one thread it causes application to crash. Sometimes it throws exception, sometimes it causes access violation and sometimes it works. Code that reproduces the bug looks like this: #include <iostream> #include <thread> #include <vector> #include <Windows.h> int _tmain(int argc, _TCHAR*

Copying std::unique_ptr's value via dereferencing

∥☆過路亽.° 提交于 2019-12-10 13:30:00
问题 I wrote the following code where I try to copy the value of unique_ptr object into a structure. #include <iostream> #include <memory> using namespace std; struct S { S(int X = 0, int Y = 0):x(X), y(Y){} // S(const S&) {} // S& operator=(const S&) { return *this; } int x; int y; std::unique_ptr<S> ptr; }; int main() { S s; s.ptr = std::unique_ptr<S>(new S(1, 4)); S p = *s.ptr; // Copy the pointer's value return 0; } It pops up errors in Visual C++ 2012: IntelliSense: no suitable user-defined

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

白昼怎懂夜的黑 提交于 2019-12-09 06:04:32
问题 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" -> "Start Performance Analysis," I encounter the error message " No launchable projects are available for profiling ." How can I profile my solution generated by CMake? 回答1: It seems I've found a way to fix it. You need to add win32 configuration under

C++ `ifdef` with concatenation of macros values

淺唱寂寞╮ 提交于 2019-12-07 04:17:59
问题 Can I achieve something similar to following code: #define MODULE base #if defined (MODULE ## _dll) <-- this should do `#ifdef base_dll` ... #else ... #endif second line is obviously wrong. Can I do this somehow? Thanks 回答1: I don't think it is possible to check the definition of token-pasted macro like that (at least I don't know the way) but you can do this: #define JOIN_INTERNAL(a,b) a ## b #define JOIN(a,b) JOIN_INTERNAL(a,b) // switch 1/0 #define base_dll 1 #define MODULE base #if JOIN

fatal error LNK1104: cannot open file 'mfc110d.lib'

只谈情不闲聊 提交于 2019-12-06 14:41:07
问题 I am currently developing a program in VS c++ 2012 ( Ultimate trial version). It uses 3rd part lib ( Qt5.1.1 x64 and openCV 2.4.5 ). When I try to build it it gives " fatal error LNK1104: cannot open file 'mfc110d.lib'". I tried to find this lib but it seems that it does not exist on my machine. This project was initially developed on a different machine. Have anyone met this problem before? 回答1: Solved! Indeed, MFC was not installed by default. I had to go to Control Panel-> Uninstall a

Azure start-up task hangs

﹥>﹥吖頭↗ 提交于 2019-12-05 18:45:59
I have an Azure project with an MVC4 role where I have added the Visual C++ 2012 Runtime Library setup file, and a script to silently install it. The script works and the library gets installed, the only problem is that the task never finishes and the installation process never exits, which then blocks the role from starting: I connected to the server using Remote Desktop, and by looking at the task manager I can see the process vcredist_x64.exe : (2 of them actually, but I think that's normal) When I right-click and kill the process, the deployment finishes successfully and the role is

std::function bound to member function

99封情书 提交于 2019-12-05 08:05:27
The following code doesn't compile in VS2012 class Zot { public: int A() { return 123; } }; int _tmain(int argc, _TCHAR* argv[]) { std::function<int (Zot*)> fn = &Zot::A; return 0; } However, changing the assignment to std::function<int (Zot*)> fn = std::bind(&Zot::A, std::placeholders::_1); Does work. There are a lot of online examples that show the original syntax. Did something change in the C++11 spec to disallow this syntax? Is there a valid shorter form for the assignment? Edit : the compiler error (slightly edited for reabability) is: 1>vc\include\functional(515): error C2664: 'std::