I'm trying to use SDL in C++ with Visual Studio 2008 Express. The following program compiles but does not link:
#include <SDL.h>
int main(int argc, char *argv[])
{
return 0;
}
The link error is:
LINK : fatal error LNK1561: entry point must be defined
I get this regardless of how or if I link with SDL.lib and SDLmain.lib. Defin...
The following code prints 20, i.e. sizeof(z) is 20.
#include <iostream.h>
class Base
{
public:
int a;
};
class X:virtual public Base
{
public:
int x;
};
class Y:virtual public Base
{
public:
int y;
};
class Z:public X,public Y
{
};
int main()
{
Z z;
cout << sizeof(z) <<endl;
}
...
I'm looking for something relatively simple to spec out a class hierarchy for C++. Can cost $ but preferably something free or at least simple and not overly feature laden and $$$.
...
Is there a standard way to do an fopen with a unicode string file path?
...
I'm trying to create a randomized maze in C++, but I can't start because I don't know how to create grids or cells. How could I create it? And I also want to create it using ASCII characters. how can i store it in array? (can any one give a sample code and some explanation so i can understand it better)
Another question: What data stuct...
I've built the following graph in GraphEdit: Logitech Webcam -> Infinite Tee Pin Filter -> VideoRenderer. This works fine (with GraphEdit automatically inserting a few intermediate filters between the TEe filter and the VideoRenderer filter).
I've tried doing the same thing in code, and it fails when trying to connect the Tee filter to ...
Hi folks,
The docs at www.fastcgi.com aren't clear on this (to me), so I hope someone can give me a definitive answer.
I have written a FastCGI application in C++ to do some heavy duty number crunching. When the application first loads (when apache starts), it performs some caching of MySQL data into a vector, which takes about a mi...
Imagine I am doing something like this:
void *p = malloc (1000);
*((char*)p) = some_opcode;
*((char*)p+1) = another_opcode; // for the sake of the example: the opcodes are ok
....
etc...
How can I define a function pointer to call p as if it was a function? (i'm using VC++ 2008 express).
Thanks
...
In C and C++, what is the difference between exit() and abort()? I am trying to end my program after an error (not an exception).
...
I wrote a device controller (rs232) and it is being used successfully, however users want to view data and control the device (or perhaps communicate through my program) from Excel. I dismissed DDE as an option and found that RTD (IRtdServer) is probably a good start (though no way to send data back to the "server" from the real time da...
Hi,
I have a these structures definitions
typedef struct my_s {
int x;
int y;
} my_T;
typedef struct your_s {
my_T * x;
} your_T;
your_T array[MAX_COL][MAX_ROW];
To initialize the array's pointer to NULL, can I do:
memset (array, 0, sizeof(array))
this does not look right to me,,, appreciate some advise.
Thanks
...
I'm used to doing Java programming, where you never really have to think about pointers when programming. However, at the moment I'm writing a program in C++. When making classes that have members of other classes, when should I use pointers and when should I not? For example, when would I want to do this:
class Foo {
Bar b;
}
As ...
I'm trying to port a Linux app to windows. Nothing huge, just a small command line utility. However, the last time I worked with C in Windows, it was a 'hello world' app in Visual Studio 6.
I'm trying to avoid meeting a new IDE, so I'd like to use Netbeans' C/C++ plugin. I just need a compiler.
Can anyone suggest a free 32-bit compi...
Say we have:
Class Base
{
virtual void f(){g();};
virtual void g(){//Do some Base related code;}
};
Class Derived : public Base
{
virtual void f(){Base::f();};
virtual void g(){//Do some Derived related code};
};
int main()
{
Base *pBase = new Derived;
pBase->f();
return 0;
}
Which g() will be c...
I want to draw a shadow around a thumbnail in my software.
It seems CreateHatchBrush can help but I do not know how to use it, can anyone provide me a sample in C++?
Many thanks!
...
What is the best way to have an associative array with arbitrary value types for each key in C++?
Currently my plan is to create a "value" class with member variables of the types I will be expecting. For example:
class Value {
int iValue;
Value(int v) { iValue = v; }
std::string sValue;
Value(std::string v) { sValue ...
How can I create a list in C++? I need it to create a linked list. How would I go about doing that? Are there good tutorials or examples I could follow?
...
My code is built to multiple .dll files, and I have a template class that has a static member variable.
I want the same instance of this static member variable to be available in all dlls, but it doesn't work: I see different instance (different value) in each of them.
When I don't use templates, there is no problem: initialize the sta...
While learning different languages, I've often seen objects allocated on the fly, most often in Java and C#, like this:
functionCall(new className(initializers));
I understand that this is perfectly legal in memory-managed languages, but can this technique be used in C++ without causing a memory leak?
...
I have a factory that builds the objects with longest lifetime in my application. These have types, lets say, ClientA and ClientB, which depend on Provider (an abstract class with many possible implementations), so both clients have a reference to Provider as member.
According to the command-line arguments, the factory chooses one imple...