Compile c++ with subproccess
I don't seem to get the output from running the compiled file on mac but
it works on windows for some reason.
test.cpp
#include<iostream>
using namespace std;
int main()
{
cout << "Hello world" << endl;
return 0;
}
Python
p = subprocess.Popen([r"/usr/bin/g++", "-Wall", "-o", "test", 'test.cpp'],
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
p.communicate()
p = subprocess.Popen(["test"], stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
p.communicate()
Just return empty output :
(b'', b'')
Is there something I need to do extra to run on mac?
No comments:
Post a Comment