Hi all,

I'm very new here.  I am looking at the Stanford cs106b videos on iTunesU.  I found the (somewhat dated) cs106b library files on the website and loaded them into a folder StanfordCPPLib in my User directory.  (windows 7).  One of collections is simpio and there are two files (simpio.h and simpio.cpp) both in the same folder.  This defined the getInteger() function which returns an integer from the console input. My problem is getting the compiler to recognize the source file.  It finds the header OK. 

Under the build optons for the project, I have the StanfordCCPLib path included in the search directory (compiler, linker and resource compiler tabs.

The following code doesn't compile and gives the error message  |undefined reference to `getInteger(std::string const&, std::string const&)'|

#include <iostream>
#include "simpio.h"

using namespace std;

int main()
{

    int i = getInteger();
    cout << i << endl;

    return 0;

}


I can make it work by doing this:


#include <iostream>
#include "simpio.h"
#include "simpio.cpp"

using namespace std;

int main()
{

    int i = getInteger();
    cout << i << endl;

    return 0;

}

The program compiles and seems to run correctly by adding #include "simpio.cpp".  I have never seen the source file included like this so I assume there is something else I need to do to configure Codeblocks, but I can't figure out what.  BTW, the program will compile without the #include if I copy the cpp file into the project source folder.

Any ideas?

Thanks, Dan