-
Notifications
You must be signed in to change notification settings - Fork 141
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* [FIXED] C++ compiler errors Fixes the case where C++ compiler errors with C2079 on C style struct definitions. Also added a simple cpp file to make sure future changes won't cause the same issue. * Fixing build removed check_cpp.cpp * Added check_cpp build * Moved rest of the inner structs * Fixed Windows build * Fixing build and format
- Loading branch information
Showing
5 changed files
with
190 additions
and
112 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
if(NOT BUILD_TESTING) | ||
return() | ||
endif() | ||
|
||
if(NOT NATS_BUILD_LIB_STATIC) | ||
MESSAGE(FATAL_ERROR | ||
"Building tests require static library, or run CMake with -DBUILD_TESTING=OFF") | ||
return() | ||
endif() | ||
|
||
if(MSVC) | ||
set_source_files_properties(test.c PROPERTIES COMPILE_FLAGS "/w") | ||
endif() | ||
|
||
# We need this to build the test program | ||
include_directories(${PROJECT_SOURCE_DIR}/src) | ||
|
||
if(NATS_BUILD_WITH_TLS) | ||
include_directories(${OPENSSL_INCLUDE_DIR}) | ||
endif(NATS_BUILD_WITH_TLS) | ||
|
||
# Build the test program | ||
add_executable(check_cpp check_cpp.cpp) | ||
|
||
target_link_libraries(check_cpp nats_static ${NATS_EXTRA_LIB}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// Copyright 2017-2025 The NATS Authors | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
#include <iostream> | ||
#include <nats.h> | ||
|
||
// Check C++ compiler compatibility of structs in | ||
// natsp.h to avoid incomplete type errors such as C2079. | ||
#include <natsp.h> | ||
|
||
int main(int argc, char **argv) | ||
{ | ||
// jsOptionsPullSubscribeAsync opts should be accessible | ||
jsFetch fetch; | ||
fetch.opts.Timeout = 1; | ||
|
||
std::cout << "OK" << std::endl; | ||
return 0; | ||
} |