I need to provide a CFG class in a separate file, but I'm unsure how to compile it together with the associated .h and the main program.
I've #includeed the .h file and I've asked for both files at the command line, but I'm not sure why this is wrong for compiling them together.
Thoughts?
CFG.cpp:
#include <iostream>
#include <stdio.h>
#include <string>
using namespace std;
class CFG
{
    public:
        string code[25];
        char startNT;
    //private:
    CFG(string inCode[], int stringLen)
    {
        for (int a = 0; a < stringLen; a++)
        {
            //cout << inCode[a] << endl;
            this->code[a] = inCode[a];
        }
        for (int a = 0; a < stringLen; a++)
        {
            cout << this->code[a] << endl;
        }
    }
    char getStartNT()
    {
        return startNT;
    }
    void setStartNT(char stNT)
    {
        startNT = stNT;
    }
    bool processData(string inString, string wkString)
    {
        //Our recursive function
        return true;
    }
    void garbage()
    {
        return;
    }
};
CFG.h:
#ifndef _cfg_h_
#define _cfg_h_
#include <iostream>
#include <stdio.h>
#include <string>
using namespace std;
class CFG
{
    public:
        string code[25];
        char startNT;
        CFG(string inCode[], int stringLen);
        char getStartNT();
        void setStartNT(char stNT);
        bool ProcessData(string inString, string wkString);
        void garbage();
};
#endif
cfg_entry.cpp:
#include <stdio.h>
#include <iostream>
#include "cfg.h"
using namespace std;
int main()
{
    string inArray[5];
    inArray[0] = "test0";
    inArray[1] = "test1";
    inArray[2] = "test2";
    inArray[3] = "test3";
    inArray[4] = "test4";
    CFG * cfg1 = new CFG(inArray, 5);
    cfg1->garbage();
    return 0;
}
Compile errors:
art@tv:~/Dropbox/Weber/CS 4110/Individual Assignment 2$ g++ -g -std=c++11 -Wall -o cfg_entry cfg.cpp cfg_entry.cpp
/tmp/ccICQEd0.o: In function `main':
/home/art/Dropbox/Weber/CS 4110/Individual Assignment 2/cfg_entry.cpp:15: undefined reference to `CFG::CFG(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, int)'
/home/art/Dropbox/Weber/CS 4110/Individual Assignment 2/cfg_entry.cpp:16: undefined reference to `CFG::garbage()'
collect2: error: ld returned 1 exit status
