PDA

View Full Version : C code integration with QT



zeenish
4th December 2011, 20:35
Hello!
I have written a code in C, now i want to display graphs and provide user interface.All i want to know is that is it possible to integrate my this C code with QT(which is written in C++) and if so than how is it possible? I am new to QT, so please give me a detailed answer :)

Oleg
4th December 2011, 22:26
Although this is a bad style, but nothing keeps you from using C code in C++/Qt app. Create a sample Qt application, explore how it works and then put your C code in it. It's hard to provide you detailed instructions, so try and ask if something will go wrong.

Santosh Reddy
5th December 2011, 03:29
Although this is a bad style
What is bad about mixing C & C++?


All i want to know is that is it possible to integrate my this C code with QT(which is written in C++) and if so than how is it possible? I am new to QT, so please give me a detailed answer
You need to have some hands on Qt C++ before you start this.

1. Create a Qt Widget project.
2. Add C code files to the project.
3. Add UI components and interface them with C code
4. You will need to have declarations in place to call C calls from C++ (Google for Mixing C and C++ Code (https://www.google.com/#sclient=psy-ab&hl=en&rlz=1C2CHNG_enUS351&source=hp&rlz=1C2CHNG_enUS351&q=Mixing+C+and+C%2B%2B+Code&pbx=1&oq=Mixing+C+and+C%2B%2B+Code&aq=f&aqi=&aql=&gs_sm=e&gs_upl=95480l95480l1l95857l1l1l0l0l0l0l0l0ll0l0&bav=on.2,or.r_gc.r_pw.,cf.osb&fp=99bad146cdf6fea4&biw=1138&bih=544))

Oleg
5th December 2011, 11:22
What is bad about mixing C & C++?
Actually I mean that such project is harder to support, as you have both c and c++ stdlibs, different memory management functions, type casts, etc, and for example
struct class is valid C, but not C++.

zeenish
5th December 2011, 11:38
Please anyone help me out of this problem, i am quite confused because i am not that much a good programmer
I want to keep my work attractive but at the same time simple and easy
Kindly guide me which library will be better in my case?? If not QT than which one i should prefer, please a detailed answer

Alir3z4
5th December 2011, 14:36
Of course it's possible, every day programmers those living with minimal wage :d make c++ wrapper for old c codes and it's obvious!
what do you need to do exactly with it? for instance for string conversation you can just simply use QString function do to that between simple c/c++ string/char.

If not QT than which one i should prefer, please a detailed answer
when you have C codes, and you need UI/gui stuff which toolkit will come in to scene? in my opinion Qt
Actually what you need is just some researching (googling :D) and yay!