Hi Adlai,
Yes, you can have multiple libraries living in the same project.
If there is a naming conflict, there are several methods:
(a) Split the code into separate files, so that each file only include either the QtCharts header or the chartdir.h header. If each file can only see one of the headers, there will be no ambiguity. For example, you can put the code for zoomscrolltrack2 into one file, and the code for QtChart into another file.
(b) If the issue occurs in a line that refers to the ChartDirector XYChart, try change it to ::XYChart.
(c) If your code includes something like "using namespace QtCharts;", try to remove that line. In this case, the compiler may consider XYChart to mean ChartDirector XYChart, while the XYChart in QtCharts will need to use QtCharts::XYChart.
(c) There is a macro CD_NAMESPACE that you can define to add a namespace of your choice to the ChartDirector API. For example, in the Qt project file, if you add "DEFINES += CD_NAMESPACE=ChartDirector", then all ChartDirector names will be in the "ChartDirector" namespace. Your code can then use "ChartDirector::XYChart" and "QtCharts::XYChart" to distinguish between the two XYCharts.
Regards
Peter Kwan |