visual-c++-2010

Errors in std::make_shared() when trying to make shared_ptr?

不打扰是莪最后的温柔 提交于 2019-11-28 07:53:18
问题 (Using Visual Studio 2010) I'm trying to create a shared_ptr of an existing class in my project (class was written a decade before std::shared_ptr existed). This class takes a non-const pointer to another object, it's empty parameter constructor is private. class Foobar { public: Foobar(Baz* rBaz); private: Foobar(); } When I try to create a shared_ptr to it, things don't go well: Baz* myBaz = new Baz(); std::shared_ptr<Foobar> sharedFoo = std::make_shared<Foobar>(new Foobar(myBaz)); On

Why does VS2010 give syntax errors when syntax is correct?

和自甴很熟 提交于 2019-11-28 05:26:16
问题 I am having a problem with VS2010 (and VS2008) giving my a great list of syntax errors. However, the syntax is indeed correct. Here is a small example; I have the following code block inside a .h file // Prototype Declarations LIST* createList (int (*compare) (void*, void*)); LIST* destroyList (LIST* plist); int addNode (LIST* pList, void* dataInPtr); bool removeNode (LIST* pList, void* keyPtr, void** dataOutPtr); bool searchList (LIST* pList, void* pArgu, void** pDataOut); bool retrieveNode

Using make_shared with a protected constructor + abstract interface

倾然丶 夕夏残阳落幕 提交于 2019-11-28 04:08:44
问题 Given an abstract interface and an implementation derived from that interface, where constructors are protected (creation of these objects only being available from a class factory - to implement a DI pattern), how can I make use of make_shared in the factory function? For example: class IInterface { public: virtual void Method() = 0; }; class InterfaceImpl : public IInterface { public: virtual void Method() {} protected: InterfaceImpl() {} }; std::shared_ptr<IInterface> Create() { std:

Trying to link Boost 1.52 thread

*爱你&永不变心* 提交于 2019-11-27 23:53:42
I am trying to compile my program but it wouldn't link at all. I have specified the path to the boost lib files and the linker still complain. Here's the linking error I got: 1>Edproj.obj : error LNK2001: unresolved external symbol "class boost::system::error_category const & __cdecl boost::system::system_category(void)" (?system_category@system@boost@@YAABVerror_category@12@XZ) 1>Edproj.obj : error LNK2001: unresolved external symbol "class boost::system::error_category const & __cdecl boost::system::generic_category(void)" (?generic_category@system@boost@@YAABVerror_category@12@XZ) 1>Edproj

Visual Studio Express 2010 license

杀马特。学长 韩版系。学妹 提交于 2019-11-27 21:47:46
Can I use Visual C++ 2010 Express compiler for commercial use? As far as I know, it was always permitted prior to 2010 version, but now when I start IDE, it writes "For Evaluation Purposes Only". I can't find the full license file anywhere (not in installed files, not in Google), so I'm in doubt, should I use it, or should I downgrade to MSVC++2008 version. I think you just need to register it. In the help menu click on register product. It will bring you on a web page where you can log in with a passport account and eventually you'll get a product key to enter into the application. And yes,

Error when installing windows SDK 7.1

一个人想着一个人 提交于 2019-11-27 17:46:43
I've run into an error when installing the Windows SDK that I've seen posted around the Internet, but none of the solutions are working for me. Here is the log I'm getting 9:43:37 AM Monday, October 14, 2013: SFX C:\Program Files\Microsoft SDKs\Windows\v7.1\Setup\SFX\vcredist_x64.exe installation started with log file C:\Users\clarkbd\AppData\Local\Temp\Microsoft Windows SDK for Windows 7_c3c42538-8a3e-439d-be39-aee3078ca098_SFX.log 9:43:43 AM Monday, October 14, 2013: C:\Program Files\Microsoft SDKs\Windows\v7.1\Setup\SFX\vcredist_x64.exe installation failed with return code 1603 9:43:53 AM

How do I fix warning MSB8012 in a static library project in Visual C++ 2010?

浪子不回头ぞ 提交于 2019-11-27 14:04:58
I am trying to convert a static library from VC++2008 to VC++2010, and I get these warnings about TargetPath and TargetName. I have had a look into my configuration and I'm not sure how to make these go away. Is it serious or is it really just an ignorable warning, for a static library that I usually build once and rarely rebuild. I think it has something to do with the fact that the project is named itk32, but the debug version of the library is named itk32d.lib, and the old way that this is configured in Visual C++ 6.0 era has resulted in some kind of weird settings staying in the vc2010

while installing vc_redist.x64.exe, getting error “Failed to configure per-machine MSU package.”

拈花ヽ惹草 提交于 2019-11-27 13:44:31
问题 While I am trying to install vc_redist.x64.exe on Windows 8.1 getting following error: Failed to configure per-machine MSU package. 回答1: Posting answer to my own question as I found it here and was hidden in bottom somewhere - https://social.msdn.microsoft.com/Forums/vstudio/en-US/64baed8c-b00c-40d5-b19a-99b26a11516e/visual-c-redistributable-for-visual-studio-2015-rc-fails-on-windows-server-2012?forum=vssetup This is because the OS failed to install the required update Windows8.1-KB2999226

How does switch compile in Visual C++ and how optimized and fast is it?

梦想的初衷 提交于 2019-11-27 08:34:49
As I found out that I can use only numerical values in C++'s switch statements, I thought that there then must be some deeper difference between it and a bunch of if-else 's. Therefore I asked myself: (How) does switch differ from if-elseif-elseif in terms of runtime speed, compile time optimization and general compilation? I'm mainly speaking of MSVC here. A switch is often compiled to a jump-table (one comparison to find out which code to run), or if that is not possible, the compiler may still reorder the comparisons, so as to perform a binary search among the values (log N comparisons). An

Disabling C++0x features in VC 2010?

依然范特西╮ 提交于 2019-11-27 07:39:39
问题 Does C++0x mode in VC++ 2010 has an off switch? I am working on a project that supposed to compile on non 0x compilers, and therefore I want to compile against the current standard. (Even if non of the new features are being used directly, there are still subtleties that makes C++0x more premissive). The closest switch I found was Configuration Properties -> C/C++ -> Language -> Disable Language Extensions but that's not it. 回答1: No, language extensions are typically non-standard vendor