Problem with std::complex

Dear ROOTers,
I had some code that use std::complex. This class also use templates (of ROOT objects). Last time I changed name of one method from this template. I clean my build, try again and…
I have problem with

Error: Symbol complex is not defined in current scope  /opt/fair_install_dec/FairRoot/nicaroot/analysis/femto/ana/NicaFemtoYLMAna.h:45:
Error: Symbol double is not defined in current scope  /opt/fair_install_dec/FairRoot/nicaroot/analysis/femto/ana/NicaFemtoYLMAna.h:45:

Because I have something like:

	std::complex<double> *fYlmBuffer; // [fMaxJM] buffer for ylm calculation

I can use ifdef CINT but I would like avoid it. I have included .I tried add #pragma linkdef class std::complex but it caused another error:

Error: link requested for unknown class std::complex<double> /opt/fair_install_dec/FairRoot/nicaroot/analysis/femto/NicaFemtoLinkDef.h:7:

This code worked before without such problems, I suppose that problem is rather caused by fact that I enforced rebuild of code than by messing in cod.
Any hints how fix this?

Hi,

what ROOT version is this?
Also I think I cannot distill a reproducer from the post above: can you provide one?

Cheers,
D

In your “NicaFemtoYLMAna.h” (or even directly in your “NicaFemtoLinkDef.h”), did you remember to:
#include <complex>

How do these new linkdef lines look like exactly?

BTW. The std::complex<double> class should already be “precompiled” by default, so you should not need to create a dedicated linkdef line for it.

Hi,
basically I’m still working on it. I cannot prepare simple “non-working class” because when I separate few classes and one that depend on them makes problem - it works :face_with_raised_eyebrow: . So I suppose there might be problem in dependencies (there is a lot of circular dependencies but they should not be visible for CINT if they are outside of headers?

Hi,

does this work with a recent ROOT version, e.g. 6.10 ?

Cheers,
D

Hi,
it works wit ROOT 6.08.
I also find source of problems in ROOT 5, it was because my project contained directory called “complex”. I don’t know why this didn’t make problems before but renaming this directory solved problem.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.