ASE Home Page Products Download Purchase Support About ASE
ChartDirector Support
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  XYChart ambiguous message
Posted by Adlai on May-18-2021 07:23

I am trying to bring zoomscrolltrack2 into my project. I have another instance of a chart which uses Qt's qabstractaxis.h.

C:devguichartdir.h(2251): note: could be 'XYChart'
C:Qt5.15.2msvc2019_64includeQtChartsqabstractaxis.h(215): note: or       'QtCharts::XYChart'

Is it possible for both to live in the same project?

Thank you.

  Re: XYChart ambiguous message
Posted by Peter Kwan on May-18-2021 13:06
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.

Peter Kwan