open-dis-cpp icon indicating copy to clipboard operation
open-dis-cpp copied to clipboard

DIS7 build error on Windows

Open leif81 opened this issue 6 years ago • 2 comments

Building results in what looks like the same 97 error for the OpenDIS7 project - a bunch of LNK2019 & LNK2001 errors.

MS Windows VM - https://developer.microsoft.com/en-us/windows/downloads/virtual-machines/

Originally posted by @rodneyp290 in https://github.com/open-dis/open-dis-cpp/pull/37#issuecomment-606974306

leif81 avatar Apr 01 '20 02:04 leif81

The errors are related to #18, as the OpenDIS7 considers utils/*.cpp as source files that include some OpenDIS 6 (dis6/*.h) files. I was able to build the OpenDIS7 with the patches below for CMake, and Premake, although that is just building it and I'm not sure it works as intended. CMake patch:

diff --git a/CMakeLists.txt b/CMakeLists.txt
index bc44ff0..0a62c03 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -19,7 +19,7 @@ target_compile_definitions(OpenDIS6 PRIVATE EXPORT_LIBRARY)
 # create list of DIS7 source files
 file(GLOB DIS7_SOURCES
   "src/dis7/*.cpp"
-  "src/utils/*.cpp"
+  "src/utils/DataStream.cpp"
 )
 # Define ExampleSender Executable
 add_library(OpenDIS7 SHARED ${DIS7_SOURCES})

Premake patch

diff --git a/premake5.lua b/premake5.lua
index 1d9d745..7f7291d 100644
--- a/premake5.lua
+++ b/premake5.lua
@@ -47,8 +47,9 @@ project "OpenDIS7"
   files {
     "src/dis7/*.h",
     "src/dis7/*.cpp",
-    "src/utils/*.h",
-    "src/utils/*.cpp"
+    "src/utils/Endian.h",
+    "src/utils/DataStream.h",
+    "src/utils/DataStream.cpp"
   }
 
 project "ExampleSender"

rodneyp290 avatar Apr 01 '20 03:04 rodneyp290

If you want to bundle all the Utils into OpenDIS7 library, then the above isn't a suitable solution as it only includes the DataStream class, and Endian enum that it requires. Just noticed as I'm typing that the Endian enum still includes the dis6/msLibMacro.h, however that isn't a problem because the dis*/msLibMacro.h files are exactly the same, and shouldn't interfere with each other. Might be a possible to consolidate them.

rodneyp290 avatar Apr 01 '20 03:04 rodneyp290

This should be fixed by the recently merged #76

I'm going to close this issue but reopen if you're still seeing an issue.

leif81 avatar Feb 04 '23 17:02 leif81