File tree Expand file tree Collapse file tree 1 file changed +33
-3
lines changed
Expand file tree Collapse file tree 1 file changed +33
-3
lines changed Original file line number Diff line number Diff line change 44cpps = glob .glob ("cpp/**/*.cpp" )
55for cpp in cpps :
66 print (cpp )
7- code = ["#include <bits/stdc++.h>\n using namespace std;\n " ]
7+ code = '''
8+ #include <bits/stdc++.h>
9+ using namespace std;
10+ struct TreeNode {
11+ int val;
12+ TreeNode *left;
13+ TreeNode *right;
14+ TreeNode(int x) : val(x), left(NULL), right(NULL) {}
15+ };
16+ struct ListNode {
17+ int val;
18+ ListNode *next;
19+ ListNode(int x) : val(x), next(NULL) {}
20+ };
21+ struct RandomListNode {
22+ int label;
23+ RandomListNode *next, *random;
24+ RandomListNode(int x) : label(x), next(NULL), random(NULL) {}
25+ };
26+ struct Interval {
27+ int start;
28+ int end;
29+ Interval() : start(0), end(0) {}
30+ Interval(int s, int e) : start(s), end(e) {}
31+ };
32+ struct TreeLinkNode {
33+ int val;
34+ TreeLinkNode *left, *right, *next;
35+ TreeLinkNode(int x) : val(x), left(NULL), right(NULL), next(NULL) {}
36+ };
37+ '''
838 with open (cpp ) as f :
9- code += f .readlines ()
39+ code += f .read ()
1040 with open ("a.cpp" , "w" ) as f :
1141 f .writelines (code )
12- cmd = "g++ a.cpp -o a.so -shared -std=c++17"
42+ cmd = "g++ a.cpp -o a.so -shared -fpic - std=c++17"
1343 if 0 != os .system (cmd ):
1444 exit (- 1 )
You can’t perform that action at this time.
0 commit comments