Qcustomplot conflicits with ncurses.h
-
When I include QCustomeplot and nurses.h into my project, they seems incompitible, my environment is
Ubuntu20.04+Qt5.12.8+CMake 3.28
the compiler error are below
[main] Building folder: Lidar [build] Starting build [proc] Executing command: /usr/local/bin/cmake --build /home/hitbuyi/AD_Projects/Vis_Projects/Lidar/build --config Debug --target all -j 18 -- [build] [ 6%] Automatic MOC for target lidar_Perception [build] [ 6%] Built target lidar_Perception_autogen [build] [ 13%] Building CXX object CMakeFiles/lidar_Perception.dir/lidar_Perception_autogen/mocs_compilation.cpp.o [build] [ 20%] Building CXX object CMakeFiles/lidar_Perception.dir/main.cpp.o [build] [ 26%] Building CXX object CMakeFiles/lidar_Perception.dir/mainwindow_lidar.cpp.o [build] In file included from /usr/include/x86_64-linux-gnu/qt5/QtGui/qtextcursor.h:46, [build] from /usr/include/x86_64-linux-gnu/qt5/QtWidgets/qlineedit.h:45, [build] from /usr/include/x86_64-linux-gnu/qt5/QtWidgets/QLineEdit:1, [build] from /home/hitbuyi/AD_Projects/Vis_Projects/Lidar/ui_fusionView.h:19, [build] from /home/hitbuyi/AD_Projects/Vis_Projects/Lidar/fusionView.h:15, [build] from /home/hitbuyi/AD_Projects/Vis_Projects/Lidar/mainwindow_lidar.h:29, [build] from /home/hitbuyi/AD_Projects/Vis_Projects/Lidar/mainwindow_lidar.cpp:1: [build] /usr/include/x86_64-linux-gnu/qt5/QtGui/qtextformat.h:816:25: error: macro "border" requires 8 arguments, but only 1 given [build] 816 | inline qreal border() const [build] | ^ [build] In file included from /home/hitbuyi/AD_Projects/Vis_Projects/Lidar/mainwindow_lidar.h:27, [build] from /home/hitbuyi/AD_Projects/Vis_Projects/Lidar/mainwindow_lidar.cpp:1: [build] /usr/include/curses.h:1229: note: macro "border" defined here [build] 1229 | #define border(ls, rs, ts, bs, tl, tr, bl, br) wborder(stdscr, ls, rs, ts, bs, tl, tr, bl, br) [build] | [build] In file included from /usr/include/x86_64-linux-gnu/qt5/QtGui/qtextcursor.h:46, [build] from /usr/include/x86_64-linux-gnu/qt5/QtWidgets/qlineedit.h:45, [build] from /usr/include/x86_64-linux-gnu/qt5/QtWidgets/QLineEdit:1, [build] from /home/hitbuyi/AD_Projects/Vis_Projects/Lidar/ui_fusionView.h:19, [build] from /home/hitbuyi/AD_Projects/Vis_Projects/Lidar/fusionView.h:15, [build] from /home/hitbuyi/AD_Projects/Vis_Projects/Lidar/mainwindow_lidar.h:29, [build] from /home/hitbuyi/AD_Projects/Vis_Projects/Lidar/main.cpp:3: [build] /usr/include/x86_64-linux-gnu/qt5/QtGui/qtextformat.h:816:25: error: macro "border" requires 8 arguments, but only 1 given [build] 816 | inline qreal border() const [build] | ^ [build] In file included from /home/hitbuyi/AD_Projects/Vis_Projects/Lidar/mainwindow_lidar.h:27, [build] from /home/hitbuyi/AD_Projects/Vis_Projects/Lidar/main.cpp:3: [build] /usr/include/curses.h:1229: note: macro "border" defined here [build] 1229 | #define border(ls, rs, ts, bs, tl, tr, bl, br) wborder(stdscr, ls, rs, ts, bs, tl, tr, bl, br) [build] | .............................................................................................................. [build] | ^~~~~~ [build] make[2]: *** [CMakeFiles/lidar_Perception.dir/build.make:104: CMakeFiles/lidar_Perception.dir/mainwindow_lidar.cpp.o] Error 1 [build] make[2]: *** Waiting for unfinished jobs.... [build] make[2]: *** [CMakeFiles/lidar_Perception.dir/build.make:90: CMakeFiles/lidar_Perception.dir/main.cpp.o] Error 1
It seems both them have some macros or function names, how to solve this problem?
-
@hitbuyi
Since QCustomPlot is a third-party offering reach out to them?
Which I see you have already done at https://www.qcustomplot.com/index.php/support/forum/2769
If it's only a header file issue (which I think is the case) don't include ncurses where you are including QCustomPlot stuff --- I find it surprising you would want both in the same module, they have very different targets. -
@JonB said in Qcustomplot conflicits with ncurses.h:
If it's only a header file issue (which I think is the case) don't include ncurses where you are including QCustomPlot stuff
No you read wrong :))
@hitbuyi said in Qcustomplot conflicits with ncurses.h:
When I include QCustomeplot and nurses.h into my project
OP wants to include nurses :)))
Wouldn't trust this kind of stuff... probably scam/fake and you don't get any nurse :D -
@Pl45m4 said in Qcustomplot conflicits with ncurses.h:
No you read wrong :))
Did I? I only glanced, but I thought it was just an issue about
ncurses.h
being#include
d, where it has a#define border ...
and that messes up something which hasborder
in QCustomPlot, no? As opposed to it being a linker symbol error.@hitbuyi said in Qcustomplot conflicits with ncurses.h:
@JonB Yes, When I exclude the ncurses.h, the compiling process is successful, If I want to use some part of ncures.h, is there any way to use both Qcustomplot and ncurses?
I cannot imagine one source file would want to include QCustomPlot stuff, which is about drawing some stuff graphically on a pixel device, together with ncurses, which is about addressing a vt100-type terminal. Even if your project as a whole uses both of these, surely they are in separate areas and can be included into those areas quite separately from each other? Because it sounds like you are just
#include
ing "everything" in a single places/source file, which can be avoided?If not, you need to look at
ncurses.h
and what it does/defines which clashes with QCustomPlot and figure how to mitigate. For example, in the error message you show if we assume you are not going to need to use the ncursesborder
macro (which is#define
d somewhere in ncurses) can you not put in#undef border
immediately after where you go#include <ncurses>
to resolve satisfactorily? -
@JonB said in Qcustomplot conflicits with ncurses.h:
Did I? I only glanced, but I thought it was just an issue about ncurses.h being #included, where it has a #define border ... and that messes up something which has border in QCustomPlot, no? As opposed to it being a linker symbol error.
The answer is far too serious for the bad joke I made above :D
The "c" is important, otherwise you are trying to include nurses :D@hitbuyi said in Qcustomplot conflicits with ncurses.h:
When I include [ ... ] nurses.h into my project
Read the topic again :)
( Ok, I'm already gone :P )