0

I'm new to C++ and I'm trying to implement all functions in a separate Functions.cpp file and calling them in the main.cpp file defining all the function declarations on the top. Both Main and the Functions file are in the same folder (sources).

But I keep getting the error undefined reference to my functions. I'm using CodeBlocks 20.30. somebody, please help.

Main.cpp file enter image description here

Functions.cpp file enter image description here

Error enter image description here

G Ajeet
  • 27
  • 5
  • Your `add` and `sumDigits` code is correct. Your `multiply` code has an `int` return in Main.cpp but a `double` return in Functions.cpp so that is an error. Because you are getting errors on all three functions though, it must mean that you are using your compiler incorrectly. Unfortunately you haven't given enough information to tell what the problem is. – john Nov 08 '20 at 10:05
  • Probably you are just failing to compile your Functions.cpp file. It not enough to just write the code, you have to tell Code Blocks to compile and link it as well. – john Nov 08 '20 at 10:06

0 Answers0