I'm using Qt and in the main method I need to declare an object that I need to use in all my other files. How can I access that object in the other files? (I need to make it global..)
I'm use to iPhone development and there we have the appDelegate that you can use all over the application to reach objects you've declared in applicationD...
Is it possible to getting rid of error C2243?
class B {};
class D : protected B {};
D d;
B *p = &d; // conversion from 'D *' to 'B &' exists, but is inaccessible
I had this error in my app and at the end I've managed to compile it by making an explicit conversion:
D d;
B *p = (B*)&d;
I can't understand why by making class D inhe...
I'm trying to understang how to use icu::BreakIterator to find specific words.
For example I have following sentence:
To be or not to be? That is the question...
Word instance of break iterator would put breaks there:
|To| |be| |or| |not| |to| |be|?| |That| |is| |the| |question|.|.|.|
Now, not every pair of break points is a...
Here is the list of mine
Unlike me -- as I did it for illustrative purposes -- don't paste too many.
And most importantly, provide an explanation
Commands shouldn't be generic but relevant to C++/C environment. ctags & scope are welcome too
gi .....................init insert mode in last insertion position
'0 ...................
int main()
{
char d = 'd';
std::string y("Hello worl");
y.append(d); // this fails
std::cout << y;
return 0;
}
I also tried, but also failed.
int main()
{
char d[1] = { 'd' };
std::string y("Hello worl");
y.append(d);
std::cout << y;
return 0;
}
Sorry for this dumb question, but I've searched around google, what ...
[related to this question]
I wrote this piece of code to understand how qt signals and slots work. I need someone to explain the behaviour, and to tell me if I'm right about my own conclusions.
My program:
connectionhandler.h
#ifndef CONNECTIONHANDLER_H
#define CONNECTIONHANDLER_H
#include <QTcpServer>
class ConnectionHandler : publ...
I'm looking for a good book on C++ and data structures that would teach me everything about linked lists, how to reverse them, arrays, how to reverse them in place and any other tricks that seem to pop up during C++ interviews lately.
...
Hi,
I´m using a class that encapsulates a thread_group, and have some questions about it
class MyGroup{
private:
boost::this_thread::id _id;
boost::thread::thread_group group;
int abc;
//other attributes
public:
void foo();
};
In the class constructor, i launch N threads
for (size_t i=0;i<N;i++){
g...
I have theoretical understanding of how dilation in binary image is done.
AFAIK, If my SE (structuring element) is this
0 1
1 1.
where . represents the centre, and my image(binary is this)
0 0 0 0 0
0 1 1 0 0
0 1 0 0 0
0 1 0 0 0
0 0 0 0 0
so the result of dilation is
0 1 1 0 0
1 1 1 0 0
1 1 0 0 0
1 1 0 0 0
0 0 0 0 0
I got ab...
I have moved my Microsoft Visual Studio 6.0/C++/MFC application to Visual Studio 2008 SP1 using the new MFC Feature Pack classes. I explicitly use nothing from the .NET Framework. However, we have trouble installing on a system which does not have .NET Framework 3.5 SP1 installed on it already. Installshield fails to load an applicati...
Hi all,
I have a QStandardItemModel with several 100,000 records of data, and a QSortFilterProxyModel on top of it for filtering and sorting capabilities. I want to remove a substantial number of records, say 100,000, based on the value of one of the columns.
The current implementation iterates over the source model, tests for the valu...
Hello, all.
I am trying to write a microshell in C++ to run in BASH. I am using getline() to read a command and its arguments as input by the user into a holding array. I use strtok() to parse the command array and return the first item (the actual command the the user wants to run) and want to use execlp() to run said command.
My pr...
Here is an example of one of the headaches I mean:
We have a multiplatform project that uses mostly Unicode strings for rendering text to the screen. On windows in VC++ the line:
swprintf(swWideDest, LEN, L"%s is a wide string", swSomeWideString);
compiles fine and prints the wide string into the other wide string.
However, this sho...
Hello,
I'm learning C++ and using VS C++ 2008 Express.
I have a simple project with 2 code files.
One is for my Class and the other is "_tmain()".
My class file is using: template <typename T> code.
The program seems to run fine, but I can't step into my class file code in c++ view. I have to look at the assembly code.
I can step in...
I work on a legacy MMC application and one thing I have noticed is that once in awhile when closing the MMC, an error will be reported.
"MMC has detected an error in a snap-in. It is recommended that you shut down and restart MMC".
How can I debug this? The error is not displayd until you close the console and if you try to attach a de...
I have a C# dll that I need to call from unmanaged C++. The main problem that I have is that my c++ code corresponds to an excel add-in, that can be installed for excel 2003 and excel 2007, when I install my add-in in excel 2007, and I try to call my C# dll, it works just fine, but for some reason that I still haven't been able to find, ...
I have this sort of C function -- that is being called a zillion times:
void foo ()
{
if (/*condition*/)
{
}
else if(/*another_condition*/)
{
}
else if (/*another_condition_2*/)
{
}
/*And so on, I have 4 of them, but we can generalize it*/
else
{
}
}
I have a good test-ca...
What is the "hanging else" problem? (Is that the right name?)
Following a C++ coding standard (forgot which one) I always
use brackets (block) with control structures. So I don't
normally have this problem (to which "if" does the last(?)
else belong), but for understanding possible problems in
foreign code it would be nice with a firm u...
Say I have function that is called a LOT from many different places. So I would like to find out who calls this functions the most. For example, top 5 callers or who ever calls this function more than N times.
I am using AS3 Linux, gcc 3.4.
For now I just put a breakpoint and then stop there after every 300 times, thus brute-forcing ...
Hello, I'm wondering if it's possible to pass a class as a parameter in c++.
Not passing a Class Object, but the class itself which would allow me to use this class like this.
void MyFunction(ClassParam mClass)
{
mClass *tmp = new mClass();
}
The above is not real code, but it hopefully explains what I'm trying to do in an example...