Re: how to use C code in qt?
Quote:
see i have one c code , printf("hello world"); normally this c program will run by gcc in console. i lyk to develop gui for this code. that is hello world should be display in dialog box of qt.. for that what i want to do??
Code:
#include <QtGui/QApplication>
#include <QLabel>
int main(int argc, char *argv[])
{
label.show();
return a.exec();
}
Quote:
how to add C code(linux c) in qt?
Qt works on C++, as C++ has in-built support for C, just compile you C code as you would do in plain C++, nothing more is required.
Quote:
what are the libraries should add?
Just include required C++ headers, no Qt files are required.
Quote:
how to use the c code in qt like how to create object and how to synchronize?
What do you mean by object, C does not have objects's concept, also what do you mean by synchronize?
Re: how to use C code in qt?
Start by reading some Qt tutorials first!
Re: how to use C code in qt?
i think u ppl doesn't understand my thread.. see am gonna design gui for my c output.. that is back end c code and front end qt code.. for that what i want to do??
//What do you mean by object, C does not have objects's concept, also what do you mean by synchronize?
that i know, i mean for that whole c code how to create a variable to access??? synchronize in the sense, that printf hello world should display in dialog box .. dont give simple example like use label like tat.. am asking synchronization of two different language... see if ve use pthread.h, time.h header file, how to add those code in qt.. ???
//Start by reading some Qt tutorials first!
i ve read enough.. but i like to know language interconnection in qt. there is no tutorials i ve found so far. tats y asked here..
Re: how to use C code in qt?
Quote:
synchronize in the sense, that printf hello world should display in dialog box
You would execute the C code using QProcess, capture the output and use C++ application to shown output from C process into dialog box.
To do it in the same application you would have to write your own printf, but its not recommended to override such standard functions.
If you just want to combine C code with C++, then just include the C code as normal.
Re: how to use C code in qt?
Or, if you're trying to call a C function from within C++, then you simply have to remember that C is already C++; you call it just like any other function, you compile it just like any other function, and you link it just like any other pre-compiled object file or library.