I have been running through c++ online coding classes as fast as I can trying to get myself up to speed but I seem to have run into an issue when I try to call my functions from separate sources. As far as I can tell I am not missing anything but I get the same error every time I try to compile and run the programs (3 seperate attempts with mini programs thus far). I have seen this question asked several times on these forums and have gone over them but I am not seeing where I am screwing this up.
I included on example below I'm not certain if it matters but I am also using codeblocks w/ mingw
The compiler error you have is because you compile only the main.cpp unit.
And cannot find a definition of CalculateVolume(double, double, double) within any .cpp files you have compiled with.
This is because you (extremely rare case: or the compiler) have forgotten to compile WITH volume.cpp file.
Otherwise this compiling error would not show up.
PS: Tested on my machine with g++. If the Error still shows up, please fill in the following info so we can all be aware of the details:
Compiler: <Name, Version>
Command to compile: <command> <flags> <source files> <options>
Additional Details: <architecture of your files> (example: headers directory path, source directory path)
It does, but he isn't doing a project. He has C::B open with just three individual files and main.cpp highlighted so it can't find it. For C::B to do it automatically you have to do File -> New Project -> Empty Project fill out the dialogs that pop up and add the three files to that project. Then it will compile with no errors.
Makefiles is a good thing to learn as well as CMake and Scons. Some teams I have worked with swear by CMake and Scons while I know that some companies still prefer Makefiles. Think it was id Software I read about who had a system in place so that at like 6am every morning Doom3 would compile so they could start debugging it as soon as they got in.
Makefile is a list of rules for how 'make' should call the compiler for you. Essentially a "project".
CMake, qmake, GNU autotools, SCons are tools that read their own rules in order to generate a Makefile (and then build). Portable project, so Makefile will have different rules on different platforms.
Code::blocks, Eclipse, Visual Studio are IDEs. Integrated Development Environments. They provide GUI for defining the project rules and execute (in background) whatever automake/make/compiler toolchain they are set to use.