c++ - How to use gnu autotool to build a qt project -


solved
compile program following setting.


new autotool , want build qt project autotool.


project structure
root/bootstrap
root/configure.ac
root/makefile.am
root/src/
----root/src/firsttry.cpp
----root/src/firsttry.h
----root/src/makefile.am

root/src/firsttry.cpp

#include <qapplication> #include <qlabel>  int main(int argc, char *argv[]) {      qapplication app(argc, argv);       qlabel *label = new qlabel("hello!world! orz...");      label->setwindowtitle("first qt!");      label->resize(200, 50);      label->show();       return app.exec(); } 

root/src/makefile.am

... add @ bottom

# qt project stuff moc-%.cc: %.h     @moc@ -o$@ $(defs) $(default_includes) $(includes) $(am_cppflags) $(cppflags) $(moc_cppflags) $<  ui-%.h: %.ui     @uic@ -o $@ $<  qrc-%.cc: %.qrc     @rcc@ -o $@ $< 

root/configure.ac
added inside configure.ac file

# check qt libraries pkg_check_modules(qt, [qtcore, qtgui, qtnetwork], [], [ac_msg_error([qt libraries required.])])  # retrieve qt compilation , linker flags cppflags="`$pkg_config --cflags-only-i qtcore qtgui qtnetwork` $cppflags" ldflags="`$pkg_config --libs-only-l qtcore qtgui qtnetwork` $ldflags" libs="`$pkg_config --libs-only-l qtcore qtgui qtnetwork` $libs"  if ! `$pkg_config --atleast-version=4.6.0 qtcore`;    ac_msg_error([qt >= 4.6.0 required.]) fi  ac_check_progs(moc, [moc-qt5 moc-qt4 moc]) ac_check_progs(uic, [uic-qt5 uic-qt4 uic]) ac_check_progs(rcc, [rcc])  if test -z "$moc" || test -z "$uic" || test -z "$rcc";    ac_msg_error([qt utility programs moc, uic, , rcc required.]) fi 

i make project these references.

problem have
got <qapplication> undefined when compiled program.
can 1 give me step-by-step tutorial?


Comments

Popular posts from this blog

wordpress - (T_ENDFOREACH) php error -

Export Excel workseet into txt file using vba - (text and numbers with formulas) -

Using django-mptt to get only the categories that have items -