Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/context-engineering/context-engineering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
#include "llama.h"
#include "logging_callback.h"
#include "model.h"
#include "platform_compat.h"
#include "tool.h"
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <functional>
#include <iostream>
#include <string>
#include <unistd.h>

static constexpr size_t DEFAULT_MAX_TOOL_CALLS = 1;

Expand Down
1 change: 0 additions & 1 deletion examples/memory/memory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
#include <iostream>
#include <map>
#include <string>
#include <unistd.h>

using agent_cpp::json;

Expand Down
1 change: 0 additions & 1 deletion examples/multi-agent/multi-agent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
#include <iostream>
#include <memory>
#include <string>
#include <unistd.h>

using agent_cpp::json;

Expand Down
2 changes: 1 addition & 1 deletion examples/shared/chat_loop.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

#include "agent.h"
#include "chat.h"
#include "platform_compat.h"
#include <cstdio>
#include <iostream>
#include <string>
#include <unistd.h>
#include <vector>

// Run an interactive chat loop with the given agent.
Expand Down
2 changes: 1 addition & 1 deletion examples/shared/logging_callback.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#pragma once

#include "callbacks.h"
#include "platform_compat.h"
#include "tool_result.h"
#include <cstdio>
#include <string>
#include <unistd.h>

// Logging callback to display tool execution information.
// Shared across examples to provide consistent tool call logging.
Expand Down
16 changes: 16 additions & 0 deletions examples/shared/platform_compat.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#pragma once

// Small compatibility shim so the examples build with MSVC, which does not
// ship <unistd.h> and prefixes the POSIX names with an underscore.
// Shared across examples to avoid repeating the same #ifdef block.

#ifdef _WIN32
#include <io.h>

#define isatty _isatty
#define popen _popen
#define pclose _pclose

#else
#include <unistd.h>
#endif // _WIN32
2 changes: 1 addition & 1 deletion examples/shell/shell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include "error_recovery_callback.h"
#include "llama.h"
#include "model.h"
#include "platform_compat.h"
#include "tool.h"

#include <algorithm>
Expand All @@ -15,7 +16,6 @@
#include <iostream>
#include <memory>
#include <string>
#include <unistd.h>

using agent_cpp::json;
using agent_cpp::ToolExecutionSkipped;
Expand Down
1 change: 0 additions & 1 deletion examples/tracing/tracing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
#include <iostream>
#include <memory>
#include <string>
#include <unistd.h>
#include <vector>

namespace trace_api = opentelemetry::trace;
Expand Down
Loading