From 06dec2551ed078a77d54ea688b2619d09d98be88 Mon Sep 17 00:00:00 2001 From: microstrain-sam <105877710+microstrain-sam@users.noreply.github.com> Date: Fri, 8 Nov 2024 14:23:52 -0500 Subject: [PATCH 1/4] Use CreateFileA instead of CreateFile. --- src/c/microstrain/connections/serial/serial_port.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/c/microstrain/connections/serial/serial_port.c b/src/c/microstrain/connections/serial/serial_port.c index 534d0ac9..9393d6f2 100644 --- a/src/c/microstrain/connections/serial/serial_port.c +++ b/src/c/microstrain/connections/serial/serial_port.c @@ -103,7 +103,7 @@ bool serial_port_open(serial_port *port, const char *port_str, int baudrate) } //Connect to the provided com port - port->handle = CreateFile(tmp_port_str, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL); + port->handle = CreateFileA(tmp_port_str, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL); // Ensure that the free() call in the following 'if' block doesn't clobber an error value DWORD last_error = GetLastError(); From 9e00035cfffb01b7abbdec3b646b5d6b3b813012 Mon Sep 17 00:00:00 2001 From: microstrain-sam <105877710+microstrain-sam@users.noreply.github.com> Date: Fri, 8 Nov 2024 14:24:13 -0500 Subject: [PATCH 2/4] Add missing compiler definitions to README for building without CMake. --- README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/README.md b/README.md index 498fc1ad..31c10e03 100644 --- a/README.md +++ b/README.md @@ -196,6 +196,18 @@ MUST be consistent between compiling the MIP SDK and any other code which includ headers from the MIP SDK. (If you change them after building, make sure everything gets rebuilt properly. Normally CMake takes care of this for you). +#### Include directories +* `src/c` +* `src/cpp` (if using C++) +* `examples` (if building/using example code) + +#### Other compiler settings +* C++14 or later is required (if using C++) + * For gcc: --std=c++14 + * For msvc: /std:c++14 + * Use C++17 or later if using metadata. +* If building TCP socket support on Windows, link against ws2_32.lib. + Known Issues ------------ From d23825cb9547500ed15ba546f08665746e9393f0 Mon Sep 17 00:00:00 2001 From: microstrain-sam <105877710+microstrain-sam@users.noreply.github.com> Date: Fri, 8 Nov 2024 16:39:55 -0500 Subject: [PATCH 3/4] Update README.md Add note about conflicting object files when building with MSVC. --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 31c10e03..ee4de049 100644 --- a/README.md +++ b/README.md @@ -175,6 +175,10 @@ include all the necessary files and define a few options. * Source files in `src/cpp/mip/extras` as needed for your project * Source files in `src/cpp/mip/metadata` if using metadata +Note: When using MSVC with C++, build the C and C++ code separately as libraries. Some C and C++ files +having the same name, and MSVC will try to compile both to the same object file. This causes one to +be overwritten by the other. + #### Required #defines for building without CMake Pass these to your compiler as appropriate, e.g. `arm-none-eabi-gcc -DMICROSTRAIN_TIMESTAMP_TYPE=uint32_t -DMICROSTRAIN_ENABLE_LOGGING=0` From d21af7850c2b084714c4582e81c29efae64134f2 Mon Sep 17 00:00:00 2001 From: microstrain-sam <105877710+microstrain-sam@users.noreply.github.com> Date: Mon, 11 Nov 2024 10:04:38 -0500 Subject: [PATCH 4/4] Clarify and fix typo in README.md --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ee4de049..65142593 100644 --- a/README.md +++ b/README.md @@ -176,8 +176,9 @@ include all the necessary files and define a few options. * Source files in `src/cpp/mip/metadata` if using metadata Note: When using MSVC with C++, build the C and C++ code separately as libraries. Some C and C++ files -having the same name, and MSVC will try to compile both to the same object file. This causes one to -be overwritten by the other. +have the same name, and MSVC will try to compile both to the same object file. This causes one to +be overwritten by the other. Building as separate libraries causes the object files to be placed in +different subdirectories, avoiding the conflict. #### Required #defines for building without CMake