-
-
Notifications
You must be signed in to change notification settings - Fork 645
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
__stderrp
is not defined
#1157
Comments
My actual objective is to compile a small Nim program to C using cosmocc, and then generate an actuallyportable binary for it... so perhaps my original program in Nim could help find out what is needed for this to work. This is the nim file import std/httpclient
import std/os
if paramCount() != 1:
quit "Please provide a single argument: URL to request."
var url = paramStr(1)
if url == "":
quit "Please enter an URL!"
echo "URL: ", url
var client = newHttpClient()
try:
echo client.getContent(url)
finally:
client.close() I am using this file (
And finally, the Nim compiler command:
|
what happens if you |
I was able to compile the code in Nim using this header file (I called it #ifndef __stdinp
#define __stdinp stdin
#endif
#ifndef __stderrp
#define __stderrp stderr
#endif
#ifndef __stdoutp
#define __stdoutp stdout
#endif And then telling the C compiler to auto-include it... which can be done by using
Perhaps Cosmopolitan could define this by default to avoid this same problem with other tools? |
I was trying to compile some Nim code using cosmocc, and it turns out the generated C code can't be compiled due to errors like this:
I created the following C file to reproduce the issue:
Compiling with
gcc
, this runs correctly.But with cosmocc I get this error:
Sorry if I am being ignorant, but it appears to me
__stderrp
, given it is used even bystdio.h
(which uses that to definestderr
), is required to be defined by the C standard itself (I would love to check the standard but I don't know where to look)?If I am just wrong, could you help me get around this problem anyway?
The text was updated successfully, but these errors were encountered: