jart / cosmopolitan

build-once run-anywhere c library
ISC License
18.43k stars 637 forks source link

Bug: Unresolved `makedev` symbol when compiling with `cosmoc++` #1281

Closed edubart closed 1 month ago

edubart commented 2 months ago

What happened?

The following example fails when compiling with C++.

#include <sys/sysmacros.h>
int main(){return makedev(1,2);}

Workaround is to use extern "C" {} when including the header <sys/sysmacros.h>, or compile as C code.

Version

cosmocc (GCC) 14.1.0

What operating system are you seeing the problem on?

Linux x86_64.

Relevant log output

cosmoc++ a.cpp -o a
/home/bart/apps/cosmocc/bin/../libexec/gcc/x86_64-linux-cosmo/14.1.0/ld.bfd: /tmp/fatcosmocc.1g6ec4iyr07v0.o: in function `main':
a.cpp:(.text+0x21): undefined reference to `makedev(unsigned int, unsigned int)'