[Rcpp-devel] Compilation errors creating qtdensity example (on Mac OS X)

Dirk Eddelbuettel edd at debian.org
Sat Apr 27 16:13:30 CEST 2013


On 27 April 2013 at 08:29, Paul Johnson wrote:
| I'm getting numerous errors when I try to create the RInside qtdensity example.
| 
| This is my first experience with Qt so I suspect there's some simple
| thing I'm not doing right.
| 
| The first two fatal compilation errors I get are:
| 
| ---
| qtdensity.cpp:37:31: error: allocation of incomplete type 'QLineEdit'
|     QLineEdit *cmdEntry = new QLineEdit(m_cmd);
|                               ^~~~~~~~~
| /usr/local/Qt-5.0.2/include/QtWidgets/qabstractspinbox.h:55:7: note: forward
|       declaration of 'QLineEdit'
| class QLineEdit;
|       ^
| qtdensity.cpp:38:14: error: no matching member function for call to 'connect'
|     QObject::connect(cmdEntry,  SIGNAL(textEdited(QString)), this,...
|     ~~~~~~~~~^~~~~~~
| /usr/local/Qt-5.0.2/include/QtCore/qobject.h:199:36: note: candidate function
|       not viable: cannot convert argument of incomplete type 'QLineEdit *' to
|       'const QObject *'
|     static QMetaObject::Connection connect(const QObject *sender, const...
| ---
| 
| The fatal errors occur when processing Qt header files, so perhaps I
| have a problem with my Qt installation.

Very likely. 

Here is what it looks like on my system.  Not a line of output from the
compiler even under -Wall:

edd at max:~/svn/rinside/pkg/inst/examples/qt$ qmake && make
g++ -c -m64 -pipe -I/usr/share/R/include -I/usr/local/lib/R/site-library/Rcpp/include -I/usr/local/lib/R/site-library/RInside/include -O2 -Wall -W -D_REENTRANT -DQT_WEBKIT -DQT_NO_DEBUG -DQT_SVG_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++-64 -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtSvg -I/usr/include/qt4 -I. -o qtdensity.o qtdensity.cpp
g++ -c -m64 -pipe -I/usr/share/R/include -I/usr/local/lib/R/site-library/Rcpp/include -I/usr/local/lib/R/site-library/RInside/include -O2 -Wall -W -D_REENTRANT -DQT_WEBKIT -DQT_NO_DEBUG -DQT_SVG_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++-64 -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtSvg -I/usr/include/qt4 -I. -o main.o main.cpp
/usr/bin/moc-qt4 -DQT_WEBKIT -DQT_NO_DEBUG -DQT_SVG_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++-64 -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtSvg -I/usr/include/qt4 -I. qtdensity.h -o moc_qtdensity.cpp
g++ -c -m64 -pipe -I/usr/share/R/include -I/usr/local/lib/R/site-library/Rcpp/include -I/usr/local/lib/R/site-library/RInside/include -O2 -Wall -W -D_REENTRANT -DQT_WEBKIT -DQT_NO_DEBUG -DQT_SVG_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++-64 -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtSvg -I/usr/include/qt4 -I. -o moc_qtdensity.o moc_qtdensity.cpp
g++ -m64 -Wl,-O1 -o qtdensity qtdensity.o main.o moc_qtdensity.o    -L/usr/lib/x86_64-linux-gnu -L/usr/lib/R/lib -lR -lblas -llapack -L/usr/local/lib/R/site-library/RInside/lib -lRInside -Wl,-rpath,/usr/local/lib/R/site-library/RInside/lib -L/usr/local/lib/R/site-library/Rcpp/lib -lRcpp -Wl,-rpath,/usr/local/lib/R/site-library/Rcpp/lib -lQtSvg -lQtGui -lQtCore -lpthread 
edd at max:~/svn/rinside/pkg/inst/examples/qt$ 

On a less-standard system, you may need to do more legwork yourself.  The
setup is consistent with Qt practice, tested and maintained.  And has worked
just fine for a number of Qt 4.* releases.

Dirk

-- 
Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com


More information about the Rcpp-devel mailing list