0Pricing
Zig Academy · Ders

Hedefler ve -target Üçlüsü

İşletim sistemini, mimariyi ve ABI'yi adlandırın.

Hedefler ve -target Üçlüsü, CoddyKit'te ücretsiz bir Zig Academy dersidir. Bu, 4 dersinin 1. dersidir. Aşağıdan dersin tamamını ücretsiz okuyabilir, sonra tarayıcıda yerleşik kod editörü ve 7/24 yapay zeka koçu ile uygulamalı olarak pratik yapabilirsin. Bu, Zig Academy öğrenme yolunun bir parçasıdır ve ilerlemeniz web ve CoddyKit uygulaması arasında senkronize olur. Zig Academy kursu toplamda 4 dersten oluşur.

Bu dersin bazı bölümleri henüz çevrilmemiş olup İngilizce olarak gösterilmektedir.

Cross-Compiling Is Built In

Zig ships every supported target inside the compiler, so cross-compilation needs no extra toolchains or downloads to begin.

The Target Triple

You name a target with a triple: it spells out the CPU architecture, the operating system, and the ABI in one string.

x86_64-linux-gnu

Three Parts, One String

Read a triple left to right as arch-os-abi. Each part narrows down exactly which binary the compiler should produce.

aarch64-macos-none

Pass It with -target

You select a target on the command line with the -target flag, and Zig builds for that machine instead of your own.

zig build-exe main.zig -target aarch64-linux-musl

The Architecture Part

The first field is the architecture, like x86_64, aarch64, or riscv64. It decides the instruction set of the output.

The OS Part

The middle field is the operating system, such as linux, macos, or windows. It shapes system calls and file formats.

The ABI Part

The last field is the ABI, like gnu, musl, or msvc. It picks the C library and calling conventions to match.

List Every Target

Not sure which triples exist? Ask Zig to print them all. zig targets dumps the supported architectures, OSes, and ABIs.

zig targets

Your Native Target

With no -target flag, Zig builds for the native triple: the same arch, OS, and ABI as the machine you are on.

Omitting Parts

You can leave fields off and Zig fills in a sensible default. x86_64-linux works because the ABI is chosen for you.

zig build-exe main.zig -target x86_64-linux

Tune the CPU Model

You can refine the architecture with a CPU model after a plus sign, asking Zig to use features of a specific processor.

zig build-exe main.zig -target x86_64-linux -mcpu=baseline

Quick Check

Recall the order of fields inside a target triple.

Recap

You learned that a target triple names arch, OS, and ABI, and that -target lets Zig build for any of them. 🌍

Sıkça Sorulan Sorular

“Hedefler ve -target Üçlüsü” dersi ücretsiz mi?

Evet — “Hedefler ve -target Üçlüsü” dersin tüm metni burada web'de ücretsiz olarak okunabilir. Etkileşimli olarak pratik yapmak (yerleşik kod editörü ve 7/24 yapay zeka koçu) ve Zig Academy kursunun geri kalanını açmak için CoddyKit PRO'ya yükselt. Zig Academy kursu toplamda 4 dersten oluşur.

“Hedefler ve -target Üçlüsü” dersinde ne öğreneceğim?

İşletim sistemini, mimariyi ve ABI'yi adlandırın. Zig Academy ile uygulamalı kodu tarayıcıda doğrudan çalıştırarak pratik yaparsın ve 7/24 yapay zeka koçu dersi çalışırken sorularını yanıtlar.

Zig Academy öğrenmeye başlamak için deneyim gerekli mi?

Önceden deneyim gerekmez. CoddyKit'te Zig Academy, başlangıçtan ileri seviyeye kadar yapılandırıldığı için buradan başlayabilir veya başından başlayıp kendi hızında ilerleme yapabilirsin. Bu, 4 dersinin 1. dersidir.

“Hedefler ve -target Üçlüsü” dersi ne kadar sürer?

Çoğu CoddyKit dersi yaklaşık 5–10 dakika sürer. Her biri kısa ve etkileşimli olduğu için sabit ilerleme yaparsın ve web ile uygulama arasında tam olarak bıraktığın yerden devam edebilirsin.

Bu Zig Academy dersinde kod yazıp çalıştırabilir miyim?

Evet. Her Zig Academy dersi yerleşik bir kod editörü içerir, bu sayede tarayıcıda gerçek kod yazıp çalıştırabilir ve anlık yapay zeka geri bildirimi alırsın — yerel kurulum gerekli değildir.

Bu kursun tüm dersleri

  1. Hedefler ve -target Üçlüsü
  2. Linux, macOS ve Windows için Derleme
  3. zig cc ile Çapraz Derleme
  4. Statik İkili Dosyalar ve musl
← Zig Academy Sayfasına Dön