Linux에서 autotools (많은 프로젝트를 수행 했음)를 사용하여 기본 Qt 애플리케이션 (Qt에 처음)을 컴파일하려고합니다.Qt moc를 autotools 프로젝트 (2017 년 사용)에서 사용하는 방법은 무엇입니까?
링크가 시작될 때까지 모든 것이 잘 컴파일 된 것처럼 보이며, 다음 결과를 얻을 때마다 문제가 발생합니다.
test-mainwindow.o: In function `MainWindow::MainWindow()':
mainwindow.cpp:5: undefined reference to `vtable for MainWindow'
mainwindow.cpp:5: undefined reference to `vtable for MainWindow'
mainwindow.o: In function `MainWindow::~MainWindow()':
mainwindow.cpp:11: undefined reference to `vtable for MainWindow'
mainwindow.cpp:11: undefined reference to `vtable for MainWindow'
mainwindow.o: In function `MainWindow::tr(char const*, char const*, int)':
mainwindow.h:10: undefined reference to `MainWindow::staticMetaObject'
collect2: error: ld returned 1 exit status
make[4]: *** [Makefile:415: test] Error 1
나는 전에 Qt는 애플 리케이션을하지, 그래서 난 내 MainWindow를 헤더의 MOC 함께 할 수있는 어쩌면 뭔가 의심, 또는 Q_OBJECT? 대부분 온라인에서 찾을 수있는 모든 사례는 4 세 이상입니다.
내 소스 디렉토리의 Makefile.am은 다음과 같습니다.
include $(top_srcdir)/common.am
bin_PROGRAMS = test
test_SOURCES = \
main.cpp \
mainwindow.cpp
test_CPPFLAGS = -I/usr/include -I/usr/local/include -I$(QT5_INCL) -I$(QT5_INCL)/QtWidgets -I$(QT5_INCL)/QtCore
test_LDFLAGS = -L/usr/lib64 -L/usr/local/lib64 -L/usr/local/lib -L$(QT5_LIBS)
test_LDADD = -lrt -lQt5Core -lQt5Gui -lQt5Widgets
그리고 나는이 시점에서하지 완전히 정확한지 확인 해요 Makefile.am, ...이를 추가하는 경우
moc-%.cpp: %.h
/usr/lib64/qt5/bin/moc $(DEFINES) $(INCPATH) $< -o [email protected]
moc-%.cc: %.h
@[email protected] [email protected] $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(MOC_CPPFLAGS) $<
ui-%.h: %.ui
@[email protected] -o [email protected] $<
qrc-%.cc: %.qrc
@[email protected] -o [email protected] $<
Automake는 내가 전에도이/승 불평 할 것이다
컴파일하려고 ...
Makefile.am:19: warning: '%'-style pattern rules are a GNU make extension
Makefile.am:24: warning: '%'-style pattern rules are a GNU make extension
Makefile.am:27: warning: '%'-style pattern rules are a GNU make extension
Makefile.am:30: warning: '%'-style pattern rules are a GNU make extension
누구나 autotools를 사용하여 moc 부분을 구현하는 방법에 대한 아이디어가 있습니까?