DGtal-team / DGtal

Digital Geometry Tools and Algorithm Library
https://dgtal.org
GNU Lesser General Public License v3.0
370 stars 115 forks source link

VS2019 compile error #1478

Closed skn123 closed 4 years ago

skn123 commented 4 years ago

dgtal_error

What could be the reason? Of course, no problems when building in Ubuntu

JacquesOlivierLachaud commented 4 years ago

There is a suspect error "cannot open source file ... CUBICALCOMPLEX.H" to be checked first. Otherwise I suspect that the compiler does not accept to befriend a template specialisation. I am trying a workaround on my branch Fix1478. Could you test it ? (I do not have Visual Studio). https://github.com/JacquesOlivierLachaud/DGtal/tree/Fix1478

skn123 commented 4 years ago

Nothing wrong with the code. The error in VS indicates that those functions have not been defined. I disabled access to those functions with a simple #ifdef statement. Now the program works. What needs to be done is to define those functions somewhere.

JacquesOlivierLachaud commented 4 years ago

They are defined in CubicalComplexFunctions.h

rolanddenis commented 4 years ago

And they are (forward) declared just few lines above so it should not worried about the definition at this step (and the error is not about a definition lack). I will take a look on my Windows!

JacquesOlivierLachaud commented 4 years ago

Cool Roland ! Can you check the workaround I did in my branch mentioned above ?

rolanddenis commented 4 years ago

I can reproduce the issue on Visual Studio 2019 and yes @JacquesOlivierLachaud , your fix works 👍

JacquesOlivierLachaud commented 4 years ago

Do you think it is an acceptable workaround ? I am opening to friendship all kinds of CubicalComplex operations, whatever the parameterised types, instead of restricting friendship to the ones with the same parameterised types. I think it is ok here, but I would feel better if you think the same. 😄

rolanddenis commented 4 years ago

In this social distancing time, it is not recommanded to shake hands with the first template parameter you meet but it should not break anything. I will do some more tests on Visual Studio (I am probably not used to but it is a real pain to configure) to understand why compilation fails with this two operators and not others ...

mgaillard commented 4 years ago

Just to tell you that I encountered the same issue in VS 2019 and the fix worked for me as well. Thank you!

JacquesOlivierLachaud commented 4 years ago

Thanks for checking also !