Can Aspose.Words for C++ and Aspose.Slides for C++ can coexist in one project?

I have a linux project which needs to use both Aspose.Words for C++ and Aspose.Slides for C++. I added the header files of both the modules to CMakeLists.txt of my project.
But I got compile error which is saying redefinition for System::ObjectExt. Then I found this class is defined in object_ext.h of both the modules.
Although I clearly separated the docx related code and pptx related code into two different cpp files, and each file will only include header files of Aspose.Words or Aspose.Slides, redefinition error still happen.
Finally I found another way without using System::ObjectExt, the problem was fixed and binary file generated successfully.
However I met error in runtime. I could correctly handle docx files before adding pptx related code. While after I added pptx related code in another separated file, error occurred after run docx file again, but the pptx related code hasn’t been called at all.
Sorry I already removed pptx code to make my docx process OK again, so that I cannot remember clearly what the error is. But ehe error looks like memory runtime corruption as far as I remembered.
I guess the so files of Aspose.Words and Aspose.Slides have some same objects definition is the root cause of this memory corruption?
So my question is whether Aspose.Words and Aspose.Slides can coexist in one project? Is it possible that same objects definition has potential problem in runtime if I put them both in my project?
Thanks

I think some common objects & methods should be moved from individual modules to a general module.

@clarence.guo,

Aspose.Words for C++ and Aspose.Slides for C++ should be able to coexist in the same project if both have the ‘same versions’. But, we will test this scenario on our end and will update you here soon. Your ticket number is WORDSCPP-1029.

@clarence.guo,

We think that the problem appears on your end because of an incorrect setup of CMake project.

Both libraries (Aspose.Words for C++ and Aspose.Slides for C++) depend on CodePorting.Native.Cs2Cpp - from header files and the dynamic library libaspose_cpp_*. so.

The redefinition error means that the compiler uses header files from both Aspose.Words for C++ and Aspose.Slides for C++ packages at the same time.

Segmentation fault is most likely related to the same thing - the application uses the dynamic library from both packages at the same time.

We have prepared an example project with proper CMake scripts which uses both libraries at the same time and in the same source file.

Please check: https://1drv.ms/u/s!AkvWspC44A6nhMJuu1VgAQOeBEblsg?e=vdLS5w

@awais.hafeez
Thank you. Your analysis does make sense.
Regarding CodePorting.Native.Cs2Cpp - from header files and the dynamic library libaspose_cpp_*. so , I found two so files against Words:

libaspose_cpp_clang3_libstdcpp.so
libaspose_cpp_gcc6.so

For Slides, there is libaspose_cpp_clang3_libstdcpp.so only.
So do you mean this so is the reason of the segmentation fault?
BTW, I cannot access your above link.

@clarence.guo,

Yes, it is possible; you can check it with ldd command. The executable should be linked with only one libaspose_cpp_*.so file.

Please try the following link:

https://drive.google.com/file/d/1dqAJk3uQr8NnzycvUKC1dRwQyi5uV4Cf/view?usp=sharing

Thank you @awais.hafeez
Basically I understand your principles.
Under Aspose.Words, there are two sets of include and lib. One is Aspose.Words.Cpp which is Words specific toolings. Another is CodePorting.Native.Cs2Cpp_* which is common toolings.
Under Aspose.Slides, there are two sets of include and lib too. One is aspose.slides.cpp which is Slides specific toolings. Another is asposecpplib which is common toolings and which is equivalent to CodePorting.Native.Cs2Cpp_* in Words.
I checked your sample project, there’s no code reference to any of the common toolings, neither CodePorting.Native.Cs2Cpp_* nor asposecpplib. But if I need to call some methods in common toolings, e.g., IShape, ObjectExt, etc, shall I only include one of the two include files?
Say I only include CodePorting.Native.Cs2Cpp_* . Then if Slides code need to call the common objects/methods, is it applicable and safe that Slides call those defined in CodePorting.Native.Cs2Cpp_* under Words?
I’m trying followed what I stated in my project.

@clarence.guo,

Both Aspose.Words for C++ and Aspose.Slides for C++ are implicitly dependent from the same CodePorting.Native.Cs2Cpp (you can check *-config.cmake). So, you should include only one file and link only with one dynamic library.

Yes, the sample project contains cmake scripts with required settings. The only requirement is that you use the same versions of Aspose.Words and Aspose.Slides libraries.

The issue you have found earlier (filed as WORDSCPP-1029) have been fixed in this Aspose.Words for C++ 20.11 update.