Hello,
For school, we use C++ as the language of choice. I am currently using QtCreator as an IDE, and for its GUI library, it is wonderful. The school is using Visual Studio.
However, most of the programs we are writing make use of cin and cout for input/output. cout works fine as output, as you can see what it puts out in the applica...
So, in a non-class type of situation, I can do something like this:
int val_to_check = 0;
int some_func(int param) {
assert(val_to_check == 0);
return param*param+param;
}
int main() {
printf("Val: %i\n", some_func(rand()));
return 0;
}
If val_to_check is declared const instead, the assertion can be folded away by the compil...
I am trying to import the download available at http://home.gna.org/fmit/ into Eclipse (on Ubuntu), compile and run.
I have managed to create a C++ project in Eclipse, and then use the project wizard to import the home folder of the FMIT download. But I am lost when it comes to using the makefile to set the project up, build and run it...
While building several different projects in QtCreator, I have run across the following build error:
collect2: ld returned 1 exit status
After only changing a few things (that should not change anything significant in the build), it will go away if it has already appeared, or it will appear if it's not there.
In my current program fo...
Hi,
I am creating header file for the fist time in dev c++
I have created add.h and add.cpp according to proper format. I don't know where to store them and when I am using header, it is showing many errors
...
Greetings,
I have a subdirs project which wraps a couple libraries and a main application. When I change something in one of the libraries the main application does not relink with them.. does anyone have a trick for getting an application to relink with its statically linked libs automatically when using QT Creator?
-Dan O
...
Hi!
I wrote a program, that should work like RunAs. It works fine, but i have one problem with it. If i want to run for example compmgmt.msc, then i should run mmc.exe and compmgmt.msc as it's parameter. Computer Management will open, but not under the user as i want to run it. It will run under that username who is logged in. Can someo...
In C++, is it possible to force the compiler to arrange a series of global or static objects in a sequential memory position? Or is this the default behavior? For example, if I write…
MyClass g_first (“first”);
MyClass g_second (“second”);
MyClass g_third (“third”);
… will these objects occupy a continuous chunk of memory, or is the...
How do I obtain a function pointer for a class member function, and later call that member function with a specific object? I’d like to write:
class Dog : Animal
{
Dog ();
void bark ();
}
…
Dog* pDog = new Dog ();
BarkFunction pBark = &Dog::bark;
(*pBark) (pDog);
…
Also, if possible, I’d like to invoke the constructor via a ...
I’m trying to do the following:
class Animal
{
class Bear : public Animal
{
// …
};
class Giraffe : public Animal
{
// …
};
};
… but my compiler appears to choke on this. Is this legal C++, and if not, is there a better way to accomplish the same thing? Essentially, I want to create a cleaner...
What's the approved way to handle second, third, etc launches of application in Windows (C++) application? I need the running (first) instance to take some special action (pop up a dialog) in this case, but for the secondary instances to terminate.
On Mac, AppleEvents sends you a 're-open' message in this scenario. Mozilla on Windows us...
Some time ago I saw a XML library for C++ which heavily utilized operator overloading, allowing for cute syntax similar to the following:
#include <iostream>
#include <some_xml_library/some_header.hpp>
using namespace some_xml_library;
int main()
{
elem_t div;
doc_t d = _ <div>"hello"<!div> _;
std::cout << d;
}
Output:
...
Because I don't exactly know how any auth method works I want to write my own.
So, what I want to do is the following.
A client sends over HTTPs username+password(or SHA1(username+password))
the server gets the username+password and generates a big random number and stores it in
a table called TOKENS(in some database) along with his IP...
I have an array of constant data like following:
enum Language {GERMAN=LANG_DE, ENGLISH=LANG_EN, ...};
struct LanguageName {
ELanguage language;
const char *name;
};
const Language[] languages = {
GERMAN, "German",
ENGLISH, "English",
.
.
.
};
When I have a function which accesses the array and find the en...
I'm currently trying to draw a class diagram of a couple of namespaces in C++.
Right now, some variables and methods inside the namespace(free, not part of classes) are part of the namespace API, others are the external part of some classes API (like operator<< and those).
I'm only willing to represent those methods/vars that expose na...
My Windows (C++) program hosts Flash ActiveX.
I use XML.sendAndLoad() to communicate to the server inside Flash part of the application.
Occasionally XML.sendAndLoad() does not call back.
That makes the whole application useless.
Only restart helps.
I have found using HTTP Analyser, that the requests even do not go to the internet.
Ther...
Hello,
I got a task related to ANCIENT C++ project which hasn't any documentation, comments at all and all code/variables is written in foreign language. Do I have a chance to analyze this code in a 1 working day and make a design/UML to create new features? I have been sitting around for 3 hours already and I feel so frustrated... Mayb...
The function header is defined below:
/**
* \fn int fx_add_buddylist(const char* name, EventListener func, void *args)
* \brief rename the group.
*
* \param name The group name which you want to add.
* \param func The send sms operate's callback function's address, and the operate result will pass to this function.
* \par...
Hi,
I'm working on translating our Qt gui at the moment.
I have the following code:
// header file
static const QString Foo;
// cpp file
const QString FooConstants::Foo = "foo";
// another cpp file
editMenu->addAction(tr(FooConstants::Foo));
This doesn't seem to work though.
That is, there is no entry in the .ts file for the abo...
I recently migrated my Qt project from Linux to Vista, and now I'm debugging signals blindly.
On Linux, if QObject::connect() fails in a debug build, I get a warning message on stderr. On Windows, there is no console output for GUI applications, only an OutputDebugString call.
I already installed DebugView, and it catches my own qDebug...