Closed mmaurus closed 5 years ago
If the build system copies files to the build folder, the source folder should not be on the include path. Can you elaborate on how your build system is set up? Are you using the provided CMake files or something else?
I would like to avoid using ifdef guards if at all possible because they are a pain-in-the-ass to maintain. E.g. if file names change the guards do not change automatically. If two files in different folders have the same name, they will most likely have the same include-guard etc.
The build system is autoproj, but msys2 does not support symbolic links on windows OS, ln -s is mapped to a copy instead of linking:
https://sourceforge.net/p/msys2/wiki/How%20does%20MSYS2%20differ%20from%20Cygwin/ Point 4. in Section "Runtime"
But I can imagine this error could come from mixing local and path includes in the tests ( "" vs. <>), at least path includes should result in using the same file.
But I can imagine this error could come from mixing local and path includes in the tests ( "" vs. <>), at least path includes should result in using the same file.
Nope, the tests do not contain local includes.
Mixing local and path includes shouldn't be a problem, either. If everything is copied to the build folder, local and path includes should result in the same file being included. My guess is that somehow the src folder is part of the include-path.
Is there a way that I can get access to a windows machine an test it somehow?
Any updates on this? Otherwise I will close it as invalid
Well my solution was using include guards! And there are mixed local and path includes in envire_core/src/graph
I removed all replaced all relative includes with path includes. Can you test if it works?
Path includes are actually a bit annoying if you are editing these files. In that case the old file is still included until the build is finished and installed -- and usually the build will fail, until the new header is included ...
@chhtz If the build system is setup correctly it should prepend the local build root to the include PATH. I.e. path includes while building will use the correct header. But I am not sure if that really works :-)
closing as no longer relevant?
pragma once is not working properly for all build systems due to its implementation.
Looks like it is only preventing reloading of the same file (same filepath). If the build system is copying the headers to the build folder, then there will be a multiple loading of the header files which result in redeclaration compile errors! http://stackoverflow.com/questions/787533/is-pragma-once-a-safe-include-guard, second reply