I get the following error when I try to compile my code Erro

I get the following error when I try to compile my code: Error   LNK2019   unresolved external symbol \"void __cdecl ReadString(char *,int)\" (?ReadString@@YAXPADH@Z) referenced in function _main   Line: 1. How do I correct this? Thanks!

#include <iostream>

// Function Prototypes=========================================================
// Do NOT change the signature of these function prototypes.
// If you do, your code will not compile with my altered main() function
// I suggest that you copy the prototypes below and then fill them in.
// ----------------------------------------------------------------------------
// Read in a line of text INCLUDING SPACES into a string.
// You may assume that the input will NOT exceed the maxLength available.
// Keep in mind that cin stops reading at a whitespace. See page 318.
void ReadString(char * c, int maxLength);

// Get the length of the string and store it in length
// Hint: How does C++ terminate a string? Look for that character!
void GetStringLength(char * c, int * length);

// PrintString - Just print the string in forward order using cout
void PrintString(char * const c);

// PrintStringBackwards - Print the string in reverse order using cout
void PrintStringBackwards(char * const c);

// Search the string for the test character. Return -1 if not found
int FindIndexOfCharacter(char * c, char testVal);

// Return a pointer to the character at the index given
char * GetValueAtIndex(char * const c, int index);

// Return the ascii integer value of the character at requested index
int GetIntegerValueOfIndex(char * c, int index);

// Print the hexadecimal value of the character at the requested index
void PrintHexValueAtIndex(char * c, int index);

// Make the entire string uppercase
void MakeUpperCase(char * c);

// Make the entire string lowercase
void MakeLowerCase(char * c);

// ============================================================================

//[BEGIN MAIN] -- Don\'t delete this line
int main()
{
   // Use these variables to test.
   // SIZE could change so make sure your code works with different sizes.
   const int SIZE = 80;
   char ca[SIZE];
   char * pc = ca;
   int fPrints = 0;
   int bPrints = 0;
   int lengthChecks = 0;
   int maxLength = 80;

   // Your code below
   // =========================

   char selection = \'z\';
   while (selection != \'Q\')
   {
       std::cout << \"[1] Test ReadString\" << std::endl;
       std::cout << \"[2] Test GetStringLength\" << std::endl;
       std::cout << \"[3] Test PrintString\" << std::endl;
       std::cout << \"[4] Test PrintStringBackwards\" << std::endl;
       std::cout << \"[5] Test FindIndexOfChararcter\" << std::endl;
       std::cout << \"[6] Test GetValueAtIndex\" << std::endl;
       std::cout << \"[7] Test MakeUpperCase\" << std::endl;
       std::cout << \"[8] Test MakeLowerCase\" << std::endl;
       std::cout << \"[9] Test GetIntegerValueAtIndex\" << std::endl;
       std::cout << \"[10] Test PrintHexValueAtIndex\" << std::endl;
       std::cout << \"[99] Quit\" << std::endl;
       std::cout << \"Selection:\";
       std::cin >> selection;
       std::cin.ignore();
       std::cout << std::endl;

       switch (selection)
       {
       case \'1\':
           ReadString(pc, SIZE);
           break;
       case \'2\':
       {
           lengthChecks += 1;
           int length = 0;
           GetStringLength(pc, &length);
           std::cout << \"Length of\";
       }

       }

       // =========================
       // Your code above

       std::cout << \"Press ENTER\";
       std::cin.get();
       return 0;
   }
   //[END MAIN] -- Don\'t delete this line

   void ReadString(char * c, int maxLength);
   {
       std::cout << \"Enter a string less than \" << maxLength << \" characters.\" << std::endl;
       // Your code here
       // ==============================

       // ==============================
   }

   void GetStringLength(char * c, int * length);

   {

   }
}
// You need to provide the rest of the functions
// See Function Prototypes at the top.

Solution

HI, I resolved compilation error.

You can continue with further coding of functions.

#include <iostream>
// Function Prototypes=========================================================
// Do NOT change the signature of these function prototypes.
// If you do, your code will not compile with my altered main() function
// I suggest that you copy the prototypes below and then fill them in.
// ----------------------------------------------------------------------------
// Read in a line of text INCLUDING SPACES into a string.
// You may assume that the input will NOT exceed the maxLength available.
// Keep in mind that cin stops reading at a whitespace. See page 318.
void ReadString(char * c, int maxLength);
// Get the length of the string and store it in length
// Hint: How does C++ terminate a string? Look for that character!
void GetStringLength(char * c, int * length);
// PrintString - Just print the string in forward order using cout
void PrintString(char * const c);
// PrintStringBackwards - Print the string in reverse order using cout
void PrintStringBackwards(char * const c);
// Search the string for the test character. Return -1 if not found
int FindIndexOfCharacter(char * c, char testVal);
// Return a pointer to the character at the index given
char * GetValueAtIndex(char * const c, int index);
// Return the ascii integer value of the character at requested index
int GetIntegerValueOfIndex(char * c, int index);
// Print the hexadecimal value of the character at the requested index
void PrintHexValueAtIndex(char * c, int index);
// Make the entire string uppercase
void MakeUpperCase(char * c);
// Make the entire string lowercase
void MakeLowerCase(char * c);
// ============================================================================
//[BEGIN MAIN] -- Don\'t delete this line
int main()
{
// Use these variables to test.
// SIZE could change so make sure your code works with different sizes.
const int SIZE = 80;
char ca[SIZE];
char * pc = ca;
int fPrints = 0;
int bPrints = 0;
int lengthChecks = 0;
int maxLength = 80;
// Your code below
// =========================
char selection = \'z\';
while (selection != \'Q\')
{
std::cout << \"[1] Test ReadString\" << std::endl;
std::cout << \"[2] Test GetStringLength\" << std::endl;
std::cout << \"[3] Test PrintString\" << std::endl;
std::cout << \"[4] Test PrintStringBackwards\" << std::endl;
std::cout << \"[5] Test FindIndexOfChararcter\" << std::endl;
std::cout << \"[6] Test GetValueAtIndex\" << std::endl;
std::cout << \"[7] Test MakeUpperCase\" << std::endl;
std::cout << \"[8] Test MakeLowerCase\" << std::endl;
std::cout << \"[9] Test GetIntegerValueAtIndex\" << std::endl;
std::cout << \"[10] Test PrintHexValueAtIndex\" << std::endl;
std::cout << \"[99] Quit\" << std::endl;
std::cout << \"Selection:\";
std::cin >> selection;
std::cin.ignore();
std::cout << std::endl;
switch (selection)
{
case \'1\':
ReadString(pc, SIZE);
break;
case \'2\':
{
lengthChecks += 1;
int length = 0;
GetStringLength(pc, &length);
std::cout << \"Length of\";
}
}

// =========================
// Your code above
std::cout << \"Press ENTER\";
std::cin.get();
return 0;
}
}
//[END MAIN] -- Don\'t delete this line
void ReadString(char * c, int maxLength){
std::cout << \"Enter a string less than \" << maxLength << \" characters.\" << std::endl;
// Your code here
// ==============================
// ==============================
}
void GetStringLength(char * c, int * length)
{
  
}
// You need to provide the rest of the functions
// See Function Prototypes at the top.

I get the following error when I try to compile my code: Error LNK2019 unresolved external symbol \
I get the following error when I try to compile my code: Error LNK2019 unresolved external symbol \
I get the following error when I try to compile my code: Error LNK2019 unresolved external symbol \
I get the following error when I try to compile my code: Error LNK2019 unresolved external symbol \

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site