diff --git a/examples/context-engineering/context-engineering.cpp b/examples/context-engineering/context-engineering.cpp index 0390d32..fd148eb 100644 --- a/examples/context-engineering/context-engineering.cpp +++ b/examples/context-engineering/context-engineering.cpp @@ -15,7 +15,13 @@ #include #include #include + +#ifdef _WIN32 +#include +#define isatty _isatty +#else #include +#endif // _WIN32 static constexpr size_t DEFAULT_MAX_TOOL_CALLS = 1; diff --git a/examples/memory/memory.cpp b/examples/memory/memory.cpp index 7e14aa9..3fe4f0c 100644 --- a/examples/memory/memory.cpp +++ b/examples/memory/memory.cpp @@ -15,7 +15,6 @@ #include #include #include -#include using agent_cpp::json; diff --git a/examples/multi-agent/multi-agent.cpp b/examples/multi-agent/multi-agent.cpp index f4e5d44..6d10b97 100644 --- a/examples/multi-agent/multi-agent.cpp +++ b/examples/multi-agent/multi-agent.cpp @@ -15,7 +15,6 @@ #include #include #include -#include using agent_cpp::json; diff --git a/examples/shared/chat_loop.h b/examples/shared/chat_loop.h index 3d090cc..fda4c7b 100644 --- a/examples/shared/chat_loop.h +++ b/examples/shared/chat_loop.h @@ -5,9 +5,15 @@ #include #include #include -#include #include +#ifdef _WIN32 +#include +#define isatty _isatty +#else +#include +#endif // _WIN32 + // Run an interactive chat loop with the given agent. // Reads user input from stdin and prints agent responses to stdout. // The loop continues until the user enters an empty line. @@ -48,3 +54,7 @@ run_chat_loop(agent_cpp::Agent& agent) printf("\nšŸ‘‹ Goodbye!\n"); } + +#ifdef _WIN32 +#undef isatty +#endif // _WIN32 diff --git a/examples/shared/logging_callback.h b/examples/shared/logging_callback.h index 72770a1..e18e270 100644 --- a/examples/shared/logging_callback.h +++ b/examples/shared/logging_callback.h @@ -4,7 +4,13 @@ #include "tool_result.h" #include #include + +#ifdef _WIN32 +#include +#define isatty _isatty +#else #include +#endif // _WIN32 // Logging callback to display tool execution information. // Shared across examples to provide consistent tool call logging. @@ -47,3 +53,7 @@ class LoggingCallback : public agent_cpp::Callback } } }; + +#ifdef _WIN32 +#undef isatty +#endif // _WIN32 diff --git a/examples/shell/shell.cpp b/examples/shell/shell.cpp index d66d06b..e339bf7 100644 --- a/examples/shell/shell.cpp +++ b/examples/shell/shell.cpp @@ -15,7 +15,16 @@ #include #include #include + +#ifdef _WIN32 +#include +#include +#define isatty _isatty +#define popen _popen +#define pclose _pclose +#else #include +#endif // _WIN32 using agent_cpp::json; using agent_cpp::ToolExecutionSkipped;