Undefined Reference Error

Getting this error when I call isPalindrome in my main function. Is it because I #include "isPalindrome.h" twice? Once in my implementation and once in my main? Any help would be appreciated, or if you need to see any other code. Thanks

isPalindrome implementation (not finished)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
 
#include <iostream>
#include <string>

#include "isPalindrome.h"
#include "LinkedStack.h"
#include "LinkedQueue.h"

bool isPalindrome(const std::string st){

  LinkedQueue<char> aQueue;
  LinkedStack<char> aStack;

  // bool ableToAdd(true)
    //   if(ableToAdd)
  for(unsigned int i(0); i < st.length(); i++){
    aQueue.enqueue(st[0]);
    aStack.push(st[0]);
  }
  // else ableToAdd = false;

  return true;
}


MAIN FUNCTION
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

#include <iostream>
#include <string>
#include <vector>

#include "isPalindrome.h"

int main() {

  std::vector<std::string> strVec = { "",
                                      "a",
                                      "aba",
                                      "abba",
                                      "deleveled",
                                      "a man a plan a canal panama",
                                      "ab",
                                      "abbc" };

  for (const std::string& str : strVec) {
    // Initialize a clean string to empty:
    std::string clean("");

    // Iterate over the string currStr and remove all space characters:
    for (char ch : str) {
      if (ch != ' ') {
        clean += ch;
      }
    }

    // Test and report whether the string in clean is a palindrome:
    if (isPalindrome(clean) ) {
      std::cout << "YES "
                << clean
                << " is a palindrome."
                << std::endl;
    }
    else {
      std::cout << "NO "
                << clean
                << " is not a palindrome."
                << std::endl;
    }
  }

  return EXIT_SUCCESS;
}

Topic archived. No new replies allowed.