Quick Start¶
Get started with CCGO in 5 minutes! This guide will walk you through creating your first cross-platform C++ project.
Create a New Project¶
# Create a new project named "hello"
ccgo new hello
# Navigate to the project directory
cd hello/hello
The generated project structure:
hello/
└── hello/ # Main project directory
├── CCGO.toml # Project configuration
├── CMakeLists.txt
├── include/ # Public headers
│ └── hello/
│ └── hello.h
├── src/ # Source files
│ └── hello.cpp
├── tests/ # Unit tests
│ └── test_hello.cpp
├── benches/ # Benchmarks
│ └── bench_hello.cpp
└── examples/ # Example programs
└── example_hello.cpp
Build for Your Platform¶
Run Tests¶
Add a Dependency¶
Edit CCGO.toml:
[dependencies]
# From Git repository
spdlog = { git = "https://github.com/gabime/spdlog.git", tag = "v1.12.0" }
# From local path
# mylib = { path = "../mylib" }
# From registry (coming soon)
# fmt = "10.1.1"
Install dependencies:
Use the dependency in your code (src/hello.cpp):
#include <spdlog/spdlog.h>
void greet(const std::string& name) {
spdlog::info("Hello, {}!", name);
}
Publish Your Library¶
Configure Your Project¶
Edit CCGO.toml to customize your project:
[package]
name = "hello"
version = "1.0.0"
description = "A cross-platform C++ library"
authors = ["Your Name <you@example.com>"]
license = "MIT"
[library]
type = "both" # "static", "shared", or "both"
namespace = "hello"
[dependencies]
spdlog = { git = "https://github.com/gabime/spdlog.git", tag = "v1.12.0" }
[build]
cpp_standard = 17
cmake_minimum_version = "3.20"
[android]
min_sdk_version = 21
target_sdk_version = 33
[ios]
min_deployment_target = "12.0"
Next Steps¶
- Configuration Guide - Learn about all CCGO.toml options
- Platforms - Platform-specific build guides
- Features - Explore CCGO features
- CLI Reference - Complete command reference
Common Commands¶
# Project creation
ccgo new <name> # Create new project
ccgo init # Initialize CCGO in existing project
# Building
ccgo build <platform> # Build for specific platform
ccgo build --docker # Build using Docker
ccgo clean # Clean build artifacts
# Testing
ccgo test # Run tests
ccgo bench # Run benchmarks
# Dependency management
ccgo install # Install dependencies
ccgo install --locked # Use exact versions from lockfile
ccgo vendor # Vendor dependencies locally
# Publishing
ccgo publish <platform> --registry <type> # Publish library
ccgo tag # Create version tag
# Utilities
ccgo check <platform> # Check platform requirements
ccgo doc --open # Generate and open documentation
Troubleshooting¶
Build Fails¶
# Check platform requirements
ccgo check android
# Try Docker build if local toolchain has issues
ccgo build android --docker
Dependency Issues¶
# Remove lock file and reinstall
rm CCGO.lock
ccgo install
# Vendor dependencies for offline builds
ccgo vendor
Need Help?¶
- Check Documentation
- Browse Examples
- Ask in GitHub Discussions
- Report bugs in GitHub Issues