I get this error and I have no idea why, this entire program uses cstrings, but when I create char word[constant] in this function it decides it hates me.
/tmp/ccCWsffn.o: In function `pickRandword(char*)':
madlibfx.cpp:(.text+0x22f): undefined reference to `pickAword(std::basic_istream<char, std::char_traits<char> >&)'
madlibfx.cpp:(.text+0x25b): undefined reference to `pickAword(std::basic_istream<char, std::char_traits<char> >&)'
madlibfx.cpp:(.text+0x287): undefined reference to `pickAword(std::basic_istream<char, std::char_traits<char> >&)'
madlibfx.cpp:(.text+0x2b3): undefined reference to `pickAword(std::basic_istream<char, std::char_traits<char> >&)'
madlibfx.cpp:(.text+0x2df): undefined reference to `pickAword(std::basic_istream<char, std::char_traits<char> >&)'
collect2: ld returned 1 exit status
and here's the code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
|
void pickAword(ifstream & streamName)
{
char word[MAX_WORD];
int number_words;
int word_number;
int newWordlength;
streamName>>number_words; //reads the number of words in the file to choose from
streamName.ignore(); //ignores the newline
word_number = ((rand() % number_words)+1);
for (int i=0; i<word_number; i++)
{
cout<<streamName.getline(word, MAX_WORD); //goes down list till the random word is selected
}
streamName.close();
newWordlength = strlen(word);
for (int j=0; j< newWordlength;j++)
cout<<word[j];
}
|
help!?