QCustomPlot Discussion and Comments

first attempt: Qt Creator can't locate qcustomplot.hReturn to overview
July 24, 2017, 03:37
by mzimmers

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?

July 24, 2017, 15:31
by Ian

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

July 24, 2017, 16:21
by mzimmers

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.

July 24, 2017, 16:30
by Isso

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

July 24, 2017, 19:02
by mzimmers

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.

July 24, 2017, 20:18
by DerManu

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.

July 24, 2017, 23:55
by mzimmers

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...

September 5, 2025, 15:24
by Poczwara

Hi
I had same error '../../qcustomplot.h' file not found

Place qcustomplot.h and qcustomplot.cpp in project directory (where pro. file is).
Replace "../../qcustomplot.h " with "<qcustomplot.h>" in pro. and mainwindow.h

In pro. file i had "\ \" (with space) , replace it with one " \ "

Some of these fixed the problem.

Problem was in QT 4.14

Good luck

AltStyle によって変換されたページ (->オリジナル) /