Skip to content

Instantly share code, notes, and snippets.

@Lucus16
Created September 5, 2019 16:30
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 Lucus16/bb1e9d226f7b388a575e621cb2aa0a56 to your computer and use it in GitHub Desktop.
Save Lucus16/bb1e9d226f7b388a575e621cb2aa0a56 to your computer and use it in GitHub Desktop.
$ nix-shell --pure -p zig glibc --run 'zig run main.zig'
/home/lars/tmp/foo/main.zig:2:11: error: C import failed
const c = @cImport(@cInclude("termios"));
^
/home/lars/tmp/foo/main.zig:2:11: note: libc headers not available; compilation does not link against libc
const c = @cImport(@cInclude("termios"));
^
/home/lars/.local/share/zig/stage1/o/XzhNJvQsO9t306oyg3q9n1dSgg77Kb5mp_EUe-JWYMXWtCcqWaACdv5tCO4OXJKV/cimport.h:1:10: note: 'termios' file not found
#include <termios>
^
/home/lars/tmp/foo/main.zig:6:23: error: container 'std.os' has no member called 'STDIN_FILENO'
c.tcgetattr(std.os.STDIN_FILENO, &term);
^
const std = @import("std");
const c = @cImport(@cInclude("termios"));
pub fn main() void {
var term: c.struct_termios = {};
c.tcgetattr(std.os.STDIN_FILENO, &term);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment