I found a sample on the Ogre forums of using Qt and Ogre together. I setup Qt, installed the MSVC plugin and created a new Qt project. I added all of the files, everything ran great.
I double clicked the .ui file in MSVC and it brought up Qt Designer, where I changed the window title and saved. For some reason, no matter what changes I ...
Does a pure-virtual object have a pointer to the vtbl?
(that probably points to NULL?)
thanks, i'm a little bit confused with all the virtual mechanism.
...
Our server is seemingly packet based. It is an adaptation from an old serial based system. It has been added, modified, re-built, etc over the years. Since TCP is a stream protocol and not a packet protocol, sometimes the packets get broken up. The ServerSocket is designed in such a way that when the Client sends data, part of the data c...
Hello. I've got a problem with this code:
#include <fstream>
struct A
{
A(std::ifstream input)
{
//some actions
}
};
int main()
{
std::ifstream input("somefile.xxx");
while (input.good())
{
A(input);
}
return 0;
}
G++ outputs me this:
$ g++ file.cpp
file.cpp: In function `int mai...
Hello,
I am having little design problem: I have one factory which will create object of with one type or another type. But my client requirement is to give(feed) the data(via setter methods) from outside world to the concrete class of type-1 not for type-2.
If I place these setter methods in interface, those need to be implemented for...
Hello, I am new to programming, I've done web development, but I am currently trying to learn real programming. The question I have is already answered here.
union ufloat {
float f;
unsigned u
};
ufloat u1;
u1.f = 0.3f;
What I don't get is how it works. What does the 0.3 part do? I couldn't find it in my text. And how does this ...
Possible Duplicate:
Two questions about inline functions in C++
Hi,
Can i declare my function as "inline" if it is a recursive function?
I've heard it may be a bit problematic/dangerous. I'd like to understand the reasons behind all this.
Thanks!
...
Hi, I have a question to ask about passing static variables between two files.
Now I have one file A.c and a second file B.cpp
In A.c
static struct {
int
int
} static_variable
Now A.c has to call a function func() in B.cpp, and this function has to modify the static_variable in A.c
In B.cpp
func() {
static_variable =...
Possible Duplicate:
Why can templates only be implemented in the header file?
hello everyone I've just read that if I write some template I must write all code in header file (including constructor, desctructors...), but I can't understand why, can somebody please explain?
...
Given the code:
#include <iostream>
using namespace std;
template <typename T>
T my_max (const T &t1, const T &t2)
{
static int counter = 0;
counter++;
cout << counter << " ";
return ((t1 > t2) ? t1 : t2);
}
int main()
{
my_max (2,3);
my_max (3.5, 4.3);
my_max (3,2);
my_max ('a','c');
}
The output is:
...
let's assume I have some class A and derived from it B:
I want to write operator= for B (let's assume that I have operator= in my A class)
right way to do this:
B& B::operator=(const B& rhs)
{
if(this == &rhs) return *this;
((A&) *this) = rhs; //<-question
//some other options
return *this
}
what is the difference if I write
((A) *t...
I get the following error when I compile:
convert.cpp: In function 'std::string convert()':
convert.cpp:62: error: expected primary-expression before 'else'
convert.cpp:62: error: expected `;' before 'else'
convert.cpp:108: error: expected `}' at end of input
convert.cpp:108: error: expected `}' at end of input
convert.cpp:108: error...
This may be the wrong approach, but as I dig deeper into developing my game engine I have ran into a timing issue.
So lets say I have a set of statements like:
for(int i = 0; i < 400; i++)
{
engine->get2DObject("bullet")->Move(1, 0);
}
The bullet will move, however, on the screen there won't be any animation. It will basically "...
I've created a program in C++ that prompts the user for a filename and for the requested filesize. The program checks if the requested filesize is bigger than the actual filesize and then adds null characters (the ones with code 0) at the end of the file, until the requested filesize is reached.
I have done it like this (with fstream):
...
I have some data like this:
1 2
3 4
5 9
2 6
3 7
and am looking for an output like this (group-id and the members of that group):
1: 1 2 6
2: 3 4 7
3: 5 9
First row because 1 is "connected" to 2 and 2 is connected to 6.
Second row because 3 is connected to 4 and 3 is connected to 7
This looked to me like a graph traversal but the f...
According to the C++0x spec, the following is legal
class A {
A(int i) : x(i) {}
A() : A(0) {}
int x;
};
But it fails to compile ("A" is not a nonstatic data member or base class of class "A") in VC 2010. Anyone know what's wrong?
...
I have a confusion about declaration and definition.
In the statement
int switchon(float duration);
Q1. Is the parameter 'duration' being defined or is it being declared?
As per section 3.1/2 of the holy Standard, it is a definition, but I am unable to understand why.
Q2. What is the exact difference between declaration and defini...
Hi,
I am reading the user guide that came with Intel concurrent collections, and I don't understand what they mean by the following sentence [Page 4 Section 1.1]:
You define an Intel Concurrent Collections for C++ graph which specifies the following:
Anybody know what do they mean by C++ Graph?
...
Hi
I'm working on a Gui-Module for Qt to plot realtime measurements like in an digital oscilloscope, based on Qwt. Everything works so far like it should, but maybe there are some features left to add ;-)
In the moment the data is stored column-wise in QVectors, together with one global timeReference QVector in one seperate QObject. So...
I get no matching member function error when i try to compile this code on my mingw32 compiler
#include <iostream>
using std::cout;
template <class T>
class Pattern
{
public:
Pattern(): element(){
cout<< "default c-tor";
}
Pattern(Pattern ©): element(copy.element){
cout<< "copy c-tor";
}
...