How to connect C++ code with QT3
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

hi tariq6000,

i guess you want it for windows, if not please tell us for which os you want that.

you have to link your project with qt-mt230nc.lib and qtmain.lib. both are in the "qt-installation-dir\lib". so go to your project-settings and add this in the linker-input-area:


if you have header, which have to be moc'ed, go to the headers-project-settings and add this:

COMMAND: %qtdir%\bin\moc.exe $(InputDir)$(InputName).h -o $(InputDir)moc_$(InputName).cpp
DESCRIPTION: Moc'ing $(InputName).h ...
OUTPUT: $(InputDir)moc_$(InputName).cpp

for this header now a "moc_headername.cpp" - file is generated, this you have to add to your project.

if you have qt-designer-ui-files, you have to add following lines to its settings:

COMMAND: %qtdir%\bin\uic.exe $(InputPath) -o $(InputDir)$(InputName).h
%qtdir%\bin\uic.exe $(InputPath) -i $(InputName).h -o $(InputDir)$(InputName).cpp
%qtdir%\bin\moc.exe $(InputDir)$(InputName).h -o $(InputDir)moc_$(InputName).cpp
DESCRIPTION: Uic'ing $(InputName).ui ...
OUTPUT: $(InputDir)$(InputName).h;$(InputDir)$(InputName).cpp;$(InputDir)moc_$(InputName).cpp

again here is a "moc_uifilename.cpp" - file generated, which has to be added to your project.

tell us, if you have problems making this setup.

good luck :)

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
1. A easy way is to copy the example project from
And add and remove files as per your requirement.

2. Make your project file and use qmake to do your job.

3. As said by ikework.

If you are new to Qt then I will suggest you to use the first method.

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.