Hi.
BaseExport and similar things are confusing my new QtCreator.
Happens to just about every header file in FreeCAD.
Interestingly, in old Qt Creator, it wasn’t much of a problem: it would just underline them, saying “skipping identifier BaseExport” or something.
Is there an easy fix for this? I tried adding add_definitions(-DBaseExport= ) to CMakeLists.txt, that fixed the parsing problem but created build errors.
temporarily adding #include <FCConfig.h> to the top of the file makes the parser happy. Fine, as long as I don’t forget to clean that out when committing.
I remember vaguely that I had such a problem before. The thing was that the precompiled.h files, which define the macros, use some freecad specific defines to guard the macro definitions. When those defines are not known to the IDE it does not find the definitions. For me it helped to change the IDE settings to set the correct “define”
Interestingly, in old Qt Creator, it wasn’t much of a problem: it would just underline them, saying “skipping identifier BaseExport” or something.
QtCreator provides a lot of plugins and for some years it uses the clang compiler to detect syntax errors and the like. If am not not totally wrong then the plugin name is ClangCodeModel which I had to disable to get rid of the warnings. Maybe you did this too with your old version and thus you didn’t see all the warnings.
Is there an easy fix for this? I tried adding add_definitions(-DBaseExport= ) to CMakeLists.txt, that fixed the parsing problem but created build errors.
I haven’t found one when I searched for a solution.
FYI, the macros BaseExport, AppExport, GuiExport, … are needed for Windows because when creating a dll you must tell the linker which symbols must be exported. For compilers on Windows the macro expands to __declspec(dllexport) for the target that creates a .dll and __declspec(dllimport) when a target uses an existing library.
So, you mustn’t simply add a definition to the CMakeLists.txt file because you will mess up the definitions inside the source code.