CauldronDevelopmentLLC / cbang

C! (cbang) is a library for cross-platform C++ development.
GNU Lesser General Public License v2.1
56 stars 39 forks source link

Include file causes compiling issues #145

Closed phdxpahob closed 9 months ago

phdxpahob commented 9 months ago

Hello,

After trying to compile camotics on ArchLiux, I got an error with the following include file:

In file included from src/camotics.cpp:23:
/opt/cbang/include/cbang/ApplicationMain.h:38:10: fatal error: cbang/os/win/Win32EventLog.h: No such file or directory
   38 | #include <cbang/os/win/Win32EventLog.h>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
scons: *** [build/camotics.o] Error 1
scons: building terminated because of errors.
==> ERROR: A failure occurred in build().
    Aborting...

After tracing the error I found out that this occurs, because when creating a package for the linux platform (os/lin) include files for OSX and Windows are not packaged (pretty good). However there isn't a platform check before ApplicationMain.h tries to include os/win/Win32EventLog.h. By placing it in #ifdef compilation runs fine. Here is a patch to fix it:

--- ../cbang-git/pkg/cbang-git/opt/cbang/include/cbang/ApplicationMain.h    2024-01-18 11:30:36.000000000 +0200
+++ /opt/cbang/include/cbang/ApplicationMain.h  2024-01-18 23:45:14.395170481 +0200
@@ -35,8 +35,9 @@

 #include <cbang/Catch.h>
 #include <cbang/openssl/SSL.h>
+#ifdef _WIN32
 #include <cbang/os/win/Win32EventLog.h>
-
+#endif

 namespace cb {
 #ifndef WINAPI

Hope this helps.

jcoffland commented 9 months ago

Fixed. Thanks!