Homework Help -- Undefined symbols for x86_64 architecture

Homework help, building a personal namespace. I have the namespace file coded and am trying to compile. From reading for the last 3 hours, it seems like I have a linker error, and I am not sure how to fix it.

Here is the content of dataChecks.cpp (my assignment specifically says to name it with .cpp extension.)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
  namespace dataChecks
{
    bool isValidInt( string str )
    {
        //Returns true if str can be parsed into a valid int, false otherwise.
        
        int start = 0;
        int i;
        bool valid = true; // assume a valid integer
        bool sign = false; // assume no sign
        
        //Check for an empty string
        if (int(str.length()) == 0) valid = false;
        
        //Check for a leading sign
        if (str.at(0) == '-' || str.at(0) == '+')
        {
            sign = true;
            start = 1; //Start checking for digits after the sign
        }
        
        // Check that there's at least one character after the sign
        if (sign && int(str.length()) == 1) valid = false;
        
        // Now check the string, which you know
        // has at least one non-sign character
        i = start;
        while (valid && i < int(str.length()))
        {
            if (!isdigit(str.at(i))) valid = false; // found a non-digit character
            i++; // move to next character
        }
        
        return valid;
        
    }
    
    int getanInt()
    {
        //Returns a valid integer entered from the keyboard.
        
        bool isvalidInt(string); // function declaration (prototype)
        bool notanint = true;
        string svalue;
        
        while (notanint)
        {
            try
            {
                cin >> svalue; //accept a string input
                if (!isvalidInt(svalue)) throw svalue;
            }
            catch (string e)
            {
                cout << "Invalid integer - Please reenter: ";
                continue; //send control to while statement
            }
            notanint = false;
        }
        
        return atoi(svalue.c_str()); // convert to an integer
    }
    
    bool isValidReal( string str )
    {
        //Returns true if str can be parsed into a valid double, false otherwise.
        
        int start = 0;
        int i;
        bool valid = true; // assume a valid integer
        bool sign = false; // assume no sign
        
        //Check for an empty string
        if (int(str.length()) == 0) valid = false;
        
        //Check for a leading sign
        if (str.at(0) == '-' || str.at(0) == '+')
        {
            sign = true;
            start = 1; //Start checking for digits after the sign
        }
        
        // Check that there's at least one character after the sign
        if (sign && int(str.length()) == 1) valid = false;
        
        // Now check the string, which you know
        // has at least one non-sign character
        i = start;
        while (valid && i < int(str.length()))
        {
            if (!isdigit(str.at(i)) && str.at(i) == '.') valid = true; // found a non-digit character
            i++; // move to next character
        }
        
        return valid;
        
    }
    
    double getaReal()
    {
        //Returns a valid real (double) entered from the keyboard.
        
        bool isvalidReal(string); // function declaration (prototype)
        bool notadouble = true;
        string svalue;
        
        while (notadouble)
        {
            try
            {
                cin >> svalue; //accept a string input
                if (!isvalidReal(svalue)) throw svalue;
            }
            catch (string e)
            {
                cout << "Invalid Double - Please reenter: ";
                continue; //send control to while statement
            }
            notadouble = false;
        }
        
        return atof(svalue.c_str()); // convert to an double
        
    }
} // end of dataChecks namespace 


And here is the content of my main.cpp

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
  //Project :   Assignment 13
//File    :   Assignment 13.cpp
//Name    :   Kirby Wood
//Date    :   04/03/14
//
// Description :  Write a program to simulate managing test scores.

#include <iostream>
#include <string>
using namespace std;
#include </Volumes/Banksy/Users/kirbatron/HDD-Documents/C++/dataChecks.cpp>
using namespace dataChecks;




//Function prototypes

int main()

{
    int value;
    double doublevalue;
    
    cout << "Enter an integer value: ";
    value = getanInt();
    
    cout << "Enter a double value: ";
    doublevalue = getaReal();
    
    return 0;
}

//function declarations and definitions



here is the error I get:

1
2
3
4
5
6
7
8
Undefined symbols for architecture x86_64:
  "dataChecks::isvalidInt(std::string)", referenced from:
      dataChecks::getanInt() in main.o
  "dataChecks::isvalidReal(std::string)", referenced from:
      dataChecks::getaReal() in main.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)


Assignment is due by midnight, any help and explanation would be a lifesaver. Am compiling on Xcode 5.1. Thanks.
Compile each *.cpp to separate object file. Linker combines the objects. Do not include *.cpp into another *.cpp. Put declarations into a header file and include that where needed.
Topic archived. No new replies allowed.