-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
strings.h should be renamed to avoid standard library conflicts. #153
Comments
At the moment, you can disable the NAppGUI
|
This would not make any difference, because the issue is not cause by the order of includes. It is caused by the mere existence of nappgui's "strings.h" in the compiler's list of paths to search for header files. If you look at the include list I posted above, you will see that nappgui's strings.h is being included by the system's /usr/include/string.h. There is nothing that can be done in code to fix that. Your To make matters worse I don't think it is even possible to force cmake to add `-I/usr/include" to the compiler flags before everything else, to ensure that the system headers are found first. "strings.h" is a standard POSIX header file name so I think it should be renamed to avoid conflicts like this, since there doesn't seem to be any workaround (at least in a cmake build). |
I have also run into a problem related to this issue. I am trying to build a NAppGUI application that links with the OpenCV library. I am able to build successfully in macOS and Windows, but the Linux build fails due to conflicts in the OpenCV and NAppGUI header files. Because OpenCV has a C++ interface, I created a .cpp file to act as the interface between the NAppGUI project and OpenCV. By not including the NAppGUI header files in that .cpp file, it is able to compile on macOS and Windows systems. However, the Linux build system fails. (maybe due to different order of searching include directories?) (I tried undefining the cast macro but as mentioned above it made no difference.) Errors during compilation in Linux (Ubuntu 24.04.1):
Test was done using a file
The CMakeLists.txt file in the project source directory:
|
Yes, its planned to resolved this issue for NAppGUI 1.5. |
Fixed in this commit: 07b4812 The problem is not with renaming
All changes are handled by CMake and
|
This file can cause build problems because it shares its name with a standard header, for example in my project:
As you can see, because
/nappgui/.../src/core/
is included as a header search path, for some reason GCC 13 tries to use nappgui'sstrings.h
first, instead of the systemstrings.h
. I'm not sure yet if there is an easy workaround for this.It may also be wise to add a namespace prefix for macros such as
cast
defined inconfig.hxx
, for examplenappgui_cast
, to avoid the potential conflict also shown above.The text was updated successfully, but these errors were encountered: