Compiling C++-code without a file

前端 未结 5 1671
无人及你
无人及你 2020-12-10 20:34

I\'m trying to compile some C++ code using your standard g++ compiler. However, rather than compiling from a file:

main.cpp:

#include 

        
5条回答
  •  孤城傲影
    2020-12-10 20:39

    How about popen("gcc -o -xc++ -", "w");? Gives you aFILE*` but the output goes straight into GCC.

    BTW, there is no point in using the -Wall flag. That's for human consumption. In fact, -w -Wfatal-errors makes sense. Either it compiles or it doesn't.

提交回复
热议问题