Consider the following class:
class Foo
{
enum Flags {Bar, Baz, Bax};
template<Flags, class = void> struct Internal;
template<class unused> struct Internal<Bar, unused> {/* ... */};
template<class unused> struct Internal<Baz, unused> {/* ... */};
template<class unused> struct Internal<Bax, unused> {/* ... */};
};
The class...
I have a problem regarding 'static const' member initialization. In a templated class I define a const member and initialize it outside the class.
When I include the .h file where this class is implemented in multiple .cpp files, I get an LNK2005 error (I'm using VS2010) that says the constant is already defined.
// List.hpp
template <...
I'm upgrading a C++ code base from VS2005 to VS2010 and I'm rebuilding some third party C++ dependencies. I have no problem building these 32-bit but keep running into problems linking 64-bit (x64). I'm getting unresolved externals for a number of standard library functions. For example:
error LNK2001: unresolved external symbol "__decl...
template <typename T> void function(T arg1,
T min = std::numeric_limits<T>::min(),
T max = std::numeric_limits<T>::max())
{
}
template <> void function<int>(int arg1, int min,int max)
{
}
int main(int argc,char* argv[])
{
function<int>(1);
}
it give syntax error C2689 and C2059 on function default argument line on :: tok...
I am trying to use one of the new features - asynchronous agents library. I just added a
unbounded_buffer m_myDataBuffer;
to my C++ class, nothing more - no agent running yet.
To enable memory leak detection in my application, I am using:
#ifdef _DEBUG
_CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF );
#endif
But a...
I'm just playing around with a grub-bootable C++ kernel in visual studio 2010.
I've gotten to the point where I have new and delete written and things such as dynamically allocated arrays work. I can use STL lists, for example. I can even sort them, after I wrote a memcpy routine. The problem is when I use the std::vector type. Simp...
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 Confi...
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 Me...
I have a templated class that performs an action on the class that is given as template argument. For some of my classes I want to 'group' the functionality in one class, to make it easier for the caller. In fact the code looks something like this (names were changed):
template<typename T>
class DoSomeProcessing
{
public:
process(T...
Two separate questions really, for those of you who have upgraded from 2008 to 2010:
Does intellisense work much better
in this version in terms of
completeness?
Does it still suffer
from corrupted NCB files and other
performance/stability issues?
...
I'm writing a small program using CLR console application and when I write something it doesn't give suggestions, although i press (Ctrl+Space). I'm using visual studio 2010
can any one help me?
...
Today I fired up Visual Studio 2010 (Visual C++) and started working on a project. The solution contains two projects. One is a static library I am writing, the other is a test application containing unit tests for the library.
Without changing anything from yesterday, the executable no longer links:
LINK : fatal error LNK1104: cannot ...
My c++ visual 2010 don't want open new project, every time when I put name of the project and click OK button after that it open my internet browser instead of Win32 Application Wizard. For better demonstration i record my steps here :
http://tinypic.com/player.php?v=iqxzk4&s=7
...
I'm trying to debug a C/C++ native DLL project from Visual Studio 2010. I'm attempting to follow these instructions:
http://msdn.microsoft.com/en-us/library/c91k1xcf(v=VS.100).aspx
I want to use the built-in debugger and be able to step code, examine structures, etc. as I would do with a regular .exe project. The instructions on the pag...
I can't believe I'm having such a hard time figuring out how to do something so simple. I have an external library (including a .lib and .h file) that I want to add to my project. From what I've read I need to go Project>Properties>Framework and references>Add new References and add it there.
However, this window is blank. There is a Pr...
Hey Guys,
I just have a problem that I have been trying to fix for the longest time.
I have a static library project in visual c++, and I want another project to be able to link to it. Up until now, I have simply been adding a reference to the static library project, which automatically links the library.
I want to be able to link to ...
Hello,
I hope some one can help me, i'm trying to create an int[400000000] (400 millions) array on my application using visual c++ 2010 but it generates an overflow error
The same code runs on linux with g++.
I need this because i'm working with large matrices.
Thank you in advance.
...
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 specified more than once; extras ignored
1 Debug\make.obj : warning LNK4042: object specified more than once; extras ignored
1 Debug\view...
I learned to program in C# and have started to learn C++. I'm using the Visual Studio 2010 IDE. I am trying to generate random numbers with the distribution classes available in <random>. For example I tried doing the following:
#include <random>
std::normal_distribution<double> *normal = new normal_distribution<double>(0.0, 0.0);
s...
I use prop files to define include directories and linkage for libraries that I want to use. We have a solution with 40+ projects and require different libraries for the different projects.
I want to use post-build event to copy the required binaries into my distribution binary folder, but currently only the first prop file post build e...