I have a server which takes some messages x and outputs some messages Y. Currently the x to y mapping is fixed. So x1 will always generate y1 with corresponding fields.
But now I want to be able to make it configurable such that the users can put their own dll which will generate x1 to y2, y3, or however they want. In case if they don'...
A class went to a school trip. And, as usually, all N kids have got their backpacks stuffed with candy. But soon quarrels started all over the place, as some of the kids had more candies than others. Soon, the teacher realized that he has to step in: "Everybody, listen! Put all the candies you have on this table here!"
Soon, ther...
Hello,
I am slowly getting used to using the Qt4 GUI framework. In a project I am working on, I need to be able to add/edit/remove Team objects in a list. Coming from a C#.NET perspective, I would do something like
List<Team> teams = new List<Team>();
teamsListBox.DataSource = teams;
teamsListBox.DisplayMember = "Name";
Then use butt...
As I noted in another SO question, I came across this article. The issue came up when I compiled boost 1.40 via MSVC7.1 and several C4251 warnings popped up.
Now, after reading said article, I wonder: Is it generally discouraged to export template code, e.g.
class DLLEXPORT_MACRO AClass
{
public:
std::vector<int> getVecCopy() { retu...
Actually, I do understand major pros and cons of using exceptions. And I use them in my projects by default as error-handling strategy.
But now I'm starting a Windows CE project with Qt library, and I see that Qt creators refused to use exceptions in the class hierarchy.
So, if I use exceptions I will need to carefully translate them to...
I have a header file, lets say Common.h, that is included in all of the files over several projects. Basically i want to declare a global variable, e.g.:
class MemoryManager;
DLL_EXPORT MemoryManager* gMemoryManager;
When i do this i get tons of linker errors saying
class MemoryManager* gMemoryManager is already defined.
:(?
...
I tried without any result.
My code looks like this:
#include "stdafx.h"
#include <iostream>
#define R() ( rand() )
#define H(a,b) ( a ## b )
#define S(a) ( # a )
#define CAT() H(S(distinct_name_), R())
int main(int argc, _TCHAR* argv[])
{
std::cout << CAT() << std::endl;
std::cout << CAT() << std::endl;
std::cout << CAT...
Is there anything wrong with having a single class (one .h) implemented over multiple source files? I realize that this could be a symptom of too much code in a single class, but is there anything technically wrong with it?
For instance:
Foo.h
class Foo
{
void Read();
void Write();
void Run();
}
Foo.Read.cpp
#include "Foo....
I have a two projects, AI and Core, which used to hold a circular dependency. I have a CoreUtilities file that I have broken up to remove this dependency, and added the functions I have removed to a new file called AIUtilities(.cpp/.h).
I then went to the piece in my AI project that uses these functions and added #include "AI/AIUtili...
Is it possible to catch a stack overflow exception in a recursive C++ function? If so, how?
so what will happen in this case
void doWork()
{
try() {
doWork();
}
catch( ... ) {
doWork();
}
}
I am not looking for an answer to specific OS. Just in general
...
Does not need to be a full debugger but i need to get a good stack trace dump when an assert is raised. A simple list of called functions is not enough. I'm pretty happy with my Eiffel system which is giving me something like
17 frames in current stack.
===== Displaying only top 10 frames in run-time stack =====
agent call wrapper 2
...
I am converting my project to use DLLs and am trying to break apart my Singleton class to avoid using templates.
My class, LudoMemory, originally inherited from Singleton. I am trying to give it the functions to destroy and create itself now and have my main engine not rely on the Singleton.
I have written a simple destroy method li...
I'm trying to write some Doxygen comment blocks, and I'd like to include example snippets of code. Of course, I'd like the examples to actually compile so they don't get stale.
My example.cpp (that I \include in the .h file) looks like this:
#include "stdafx.h"
#include "../types_lib/Time_Limiter.h"
#include <vector>
void tl_demo ()...
I'm trying to use the ofstream class to write some stuff to a file, but all that happens is that the file gets created, and then nothing. I have some simply code here:
#include <iostream>
#include <fstream>
#include <cstring>
#include <cerrno>
#include <time.h>
using namespace std;
int main(int argc, char* argv[])
{
ofstream file;
...
I'm working on a multi-threaded win32 MFC application. We are rendering a map and displaying it in a pane in the user interface along with custom-rendered objects on top. It's slow to render (~800 ms), which is happening on the User Interface thread.
I'm trying to move the rendering onto its own thread so that the menus still remain s...
Given int a;, I know that the following returns the largest value that a can hold.
numeric_limits<int>::max()
However, I'd like to get this same information without knowing that a is an int. I'd like to do something like this:
numeric_limits<typeof<a>>::max()
Not with this exact syntax, but is this even possible using ISO C++?
Thank...
Solve this equation for x, (1 + x)^4=34.5 . I am interested in the math libraries you'd use.
the equation is MUCH SIMPLER (1 + x)^4=34.5
thanks
...
Hi!
I'm getting an error called, "corruption of the heap" when I try to debug this simple code,
CvCapture* capture = cvCaptureFromFile("1.avi");
if( capture )
{
cvNamedWindow( "Motion", 1 );
while(true)
{
//Grab the frame and display the image
//No...
I have a cpp file from which I am generating a shared library (using autofoo and the like). Within the cpp file, I have declared a couple of static fields that I use throughout the library functions.
My question is 2-part:
1) Where are these fields stored in memory? It's not as if the system instantiates the entire library and keeps ...
I have a very simple (currently just a main.cpp) CMake C++ project that I'm trying to build on both Mac OS X and Windows. It depends on libgsasl, which I have compiled as a static library on both platforms.
Mac OS X has no problems building, and Windows doesn't complain during the build either and produces an EXE. When I try to run the ...