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

Paul Johnson paul at askerko.net
Sun Apr 28 04:55:11 CEST 2013

I have a Mac running the latest version of Mac OS X and the latest
version of Xcode. In the Mac world it would be referred to as the
STANDARD system. I've installed the latest Qt 5.0.2 on my Mac. (This
is the version of choice on the Qt website.) I have followed the
directions in the ReadMe file for the release to set up the header and
library paths. I have repeated this twice and carefully verified that
I'm following the Qt 5.0.2 installation and usage procedures. The qt
RInside example won't compile and the two errors I listed in my
original post are the first fatal errors the compiler reports.

After not having success with Qt 5.0.2 I uninstalled it and downloaded
the old 4.8 version of Qt. On a Mac with Qt 4.8 the qmake runs but
generates a garbage Xcode project file and generates no Makefile at
all. So, even with Qt 4, the qt RInside example won't compile on a

If there are any Mac cognoscenti who can offer some insight on issues
with Qt on a Mac I'd appreciate hearing from you.

My current approach is to uninstall Qt 4.8 and reinstall Qt 5.0.2 and
work towards fixing the compile errors in the qt RInside example.

On Sat, Apr 27, 2013 at 9:13 AM, Dirk Eddelbuettel <edd at debian.org> wrote:
> 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