(C++) QCanvas: No such file or directory
February 24, 2017 · View on GitHub
(C++) QCanvas: No such file or directory
Full error message
/MyFolder/main.cpp:1: error: QCanvas: No such file or directory
Cause
Operating system: Ubuntu 10.04 LTS Lucid Lynx
IDE: Qt Creator 2.0.0
Project type: Console Application
Libraries used:
- Qt: version 4.7.0 (32 bit)
Qt project file
#------------------------------------------------- # # Project created by QtCreator 2010-07-26T10:46:45 # #------------------------------------------------- QT += core QT -= gui TARGET = CppCompileErrorQCanvasNoSuchFileOrDirectory CONFIG += console CONFIG -= app_bundle TEMPLATE = app SOURCES += main.cpp
Source code
#include <QCanvas> int main() { }
Solution
As far as I can understand, QCanvas is a Qt3 class that is obsolete in Qt Creator 2.0.0.
The code below, although #including the proper header file, will give the compile error ':: error: collect2: ld returned 1 exit status'.
#include <qt3/qcanvas.h> int main() { }