My IDE is Eclipse FYI
This is a key detail. You did yourself and others a disservice by burying it in a semi-parenthetical comment at the end of the question.
When I compile, console displaysL: make: Nothing to be done for 'all'.
Your IDE has some specific expectations for makefile conventions, and your makefile does not satisfy them. In particular, the message presented indicates that it is trying to build a target named "all". Your makefile does not provide a rule for building any such target. Although not required in a general sense, it is conventional for makefiles to provide a target named "all" as a top-level entry point. In a makefile that provides this target, building it should build the whole project, with the possible exception of tests and test-support-only targets.
You can resolve this issue by adding the expected target. It can go anywhere with respect to the other rules, but it would be most conventional to put it first. Additionally, it would be a good idea, albeit not required, to declare it .PHONY
(see What is the purpose of .PHONY in a makefile?):
all: math
math: main.o function.o
g++ main.o function.o -o math
main.o: main.cpp
g++ -c main.cpp
function.o: function.cpp
g++ -c function.cpp
clean:
rm *.o math
.PHONY: all