Created
May 10, 2021 23:19
-
-
Save EmperorPenguin18/3e03c8df283b37a6b6ed8545d6ce3a59 to your computer and use it in GitHub Desktop.
Helper script to compile C++ programs that require OpenCV
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <string> | |
using namespace std; | |
string input; | |
string input_clipped; | |
int i; | |
int main(int argc, char **argv) | |
{ | |
for (i = 1; i < argc; i++) | |
{ | |
input_clipped = argv[i]; | |
input = input_clipped; | |
input_clipped.erase ( input_clipped.end()-4, input_clipped.end() ); | |
system( ("rm " + input_clipped).c_str() ); | |
system( ("g++ " + input + " -o " + input_clipped + " `pkg-config opencv --cflags --libs`").c_str() ); | |
cout << "Compile successful" << '\n'; | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment