The problem occurs, when your files are not linked to each other or,
better said, to the project.
a) For Clion use/add the following syntax/project files in CMakeLists.txt
add_executable(<<projectname>> main.cpp first.h first.cpp secound.h secound.cpp ...)
b) For Terminal use:
You simply need to compile all your *.cpp files.
Your compile command should look somthing like this:
g++ proba.cpp main.cpp [any other cpp files I don't know about]