Skip to content

Instantly share code, notes, and snippets.

@EmperorPenguin18
Created May 10, 2021 23:19
Show Gist options
  • Save EmperorPenguin18/3e03c8df283b37a6b6ed8545d6ce3a59 to your computer and use it in GitHub Desktop.
Save EmperorPenguin18/3e03c8df283b37a6b6ed8545d6ce3a59 to your computer and use it in GitHub Desktop.
Helper script to compile C++ programs that require OpenCV
#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