There is a Getting Started guide: https://github.com/ocornut/imgui/wiki/Getting-Started But at heart your question is a question about the build process in C/C++.
You need your program to somehow link with the code contained in dear imgui. Usually it means compiling the imgui sources files (imgui/*.cpp) into your project. But if you compile them on the command-line in one command you are going to recompile the whole library everytime, which is a bit wasteful for your time.
People use build systems such as Makefile, cmake, premake to organize their building into smaller chunks, which 99% of the time involve compiling each .cpp file into an object file, and then linking all object files into a program. This way the .cpp files are only recompiled when changed or when one of the dependency they use is changed. You should read about those.