QCustomPlot Discussion and Comments

first attempt: Qt Creator can't locate qcustomplot.hReturn to overview

Hi -

I'm trying to follow the example in the tutorial. I installed QCP into /opt/qtcustomplot, and added the files from there into my project. I did the promote step and everything seemed to work. But when I try to build, I get an error saying it can't find "qcustomplot.h" from my ui_widget.h file.

Any idea what I did wrong?

sounds like your project file doesnt have that path in its includes list.

I do though:

HEADERS += \
    demodulator/nyquist.h \
    types.h \
    constants.h \
    widget.h \
    worker.h \
    demodulator/demod.h \
    /opt/qcustomplot/qcustomplot.h

Originally the file path was relative...same error either way.

I've also re-run qmake.

I deleted the promotion and re-created it, including a pathname in the header file entry. This seems to have solved it, though I'm not sure it was the best way to go.

The problem is your include statement. Do you #include "/opt/...." or do you add INCLUDES += /opt/qcustomplot to your pro file?

I had tried adding the INCLUDES line, but it still didn't work. And I don't have control over how the forms editor creates the #include directives.

Adding the path during the promotion is an acceptable workaround IMO.

I recommend placing the qcustomplot.h/.cpp files into the project or source directory of your project, and not in a generic location like /opt/.
To keep it clean, you can of course use subdirectories like [your src dir]/external/qcustomplot/.
When you promote a widget or #include the qcustomplot.h, you of course need to specify the respective directory, or add it to the includes path.

Hi, DerManu -

Yes, I tend to agree. I originally chose /opt because I had no idea how small the installation footprint was. I'll probably take your suggestion going forward. Thanks...