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)
does not codeblock automatically manage your build ? Eclipse does :P
I'm not to sure I know what you are asking I assume you meant that Eclipse takes your source files and automatically links them. If that is the case no codeblocks does not appear to do this.
I apologize for my lack of understanding I am very new to coding and I am sort of just playing around with it to see what I can do.
keskiverto I assume you are referring to this when your talking about GCC?
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.
I was just going to say that after digging through user manual a bit I figured out more what you meant by managed projects.
In code blocks under my build options I realized that I did not have all 3 files set to build. (only main.cpp)
After clicking a stupid check box and about 2 hours of my life I feel more a scrub now then I did before I asked the question I appreciate all the help you guys put me on the right track.
should anyone else run into this problem here is how to fix it
Project > Properties > Build targets
At the bottom center you will find all your build target files make sure they are selected!
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.