trampgeek / jobe

jobe is a server that runs small programming jobs in a variety of programming languages
MIT License
110 stars 78 forks source link

Inline function readoptarg: undefined reference in gcc 5 #6

Closed sergeyfrolov closed 8 years ago

sergeyfrolov commented 8 years ago

Inline function readoptarg(), defined in .c file(asaik, it's a good practice to define inline functions in headers), causes undefined reference with newer gcc 5+, because it switched from -std=gnu89 to -std=c11 by default

runguard.c:(.text+0x13cd): undefined reference to `readoptarg'
runguard.c:(.text+0x1432): undefined reference to `readoptarg'
runguard.c:(.text+0x1497): undefined reference to `readoptarg'
runguard.c:(.text+0x1538): undefined reference to `readoptarg'
collect2: error: ld returned 1 exit status

Workaround: set -std=gnu89 manually.

trampgeek commented 8 years ago

Thanks Sergey. I've removed the inlining of that function. [runguard.c is from the domjudge package; I see the latest version doesn't have any inline functions, either.]