Skip to content

Instantly share code, notes, and snippets.

@naltun
Last active January 28, 2020 16:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save naltun/a1a305584d5f890d2f3914eece275e25 to your computer and use it in GitHub Desktop.
Save naltun/a1a305584d5f890d2f3914eece275e25 to your computer and use it in GitHub Desktop.
My basic main.zig and Makefile
// main.zig
const std = @import("std");
const warn = std.debug.warn;
const libcurl = @cImport(@cInclude("/usr/include/curl/curl.h"));
pub fn main() void {
const curl = libcurl.curl_easy_init();
warn("Hello, World!\n");
}
// Makefile
TARGET=test
all:
zig build-exe src/main.zig \
--name test \
--output-dir release/ \
--library c \
--library curl
clean:
rm release/{${TARGET},${TARGET}.o}
// Output
$ make
zig build-exe src/main.zig \
--name test \
--output-dir release/ \
--library c \
--library curl
lld: error: unable to find library -lcurl
make: *** [Makefile:4: all] Error 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment