Move variable declaration and linking opencv