If you are new to programming, then having to write your first OpenCV program, to build it and run it can be intimidating and the process is a literal minefield.
I have created a simple C++ project that helps you get started with OpenCV on Ubuntu. I have used CMake to build the project since that makes it easier to add new source files and libraries. This simple program reads an image file and displays it. Everything you need to get started is included. Get the project at Github here. Remember to read the readme.txt file🙂