c – 如何从stdin编译代码?

c – 如何从stdin编译代码?,第1张

概述参见英文答案 > Is it possible to get gcc to read from a pipe?                                    2 >             Compiling C++-code without a file                                    5个 代码很简单: test$cat test. 参见英文答案 > Is it possible to get gcc to read from a pipe?2
> Compiling C++-code without a file5个
代码很简单:
test$cat test.cppint main(){}

有没有办法编译来自标准输出的代码?

我试过这个:

cat test.cpp | g++ -

和一些变化,但没有一个可执行.

只是一些澄清.我有一个预处理文件的程序,并生成另一个我要编译的文件.我想到没有创建这个中间文件,而是直接生成对象文件.

解决方法 编译器可能会告诉你:
-E or -x required when input is from standard input

尝试

cat test.cpp | g++ -x c++ -
总结

以上是内存溢出为你收集整理的c – 如何从stdin编译代码?全部内容,希望文章能够帮你解决c – 如何从stdin编译代码?所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/langs/1233015.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-06-06
下一篇2022-06-06

发表评论

登录后才能评论

评论列表(0条)

    保存