teufelfisch
09-13-2002, 06:22 AM
I need some help..
I am starting a cryptography program in C++, but have hit a snag with my linker. Any time I try to compile the backbone of the program, I get about six "link error: undefined symbol ... " errors.
This is the first time I have seen these errors from the software I use (Metrowerks Code Warrior).
Source:
/* Author: teufelfisch
Filename: "test.cpp"
Last Mod: 5/22/02 */
// [Includes]
#include <iostream>
#include <fstream>
#include "./stuff/apstring.h"
using namespace std;
// [Classes]
enum inType { UFILE, STRING };
// [Prototypes]
void crypt(); //Actual cryptography SR
inType promptU(); //Prompts user for type: read from string or file
void inString(); //Gets string from user to be crypted
void inFile(); //Reads file to be crypted
// [Definitions]
inType promptU()
{ char marm;
inType retType;
bool exitFlag = true;
do
{ cout << endl << "Type of input (f/s): ";
cin >> marm;
marm = toupper(marm);
if (marm == 'F')
retType = UFILE;
else
{ if (marm == 'S')
retType = STRING;
else
{ cout << endl << "Invalid type. Please specify file or string.";
exitFlag = false; }
}
}
while (exitFlag == false);
return retType;
}
void inString()
{ apstring ustring;
cout << endl << "Please type the text to be encrypted." << endl;
getline(cin, ustring);
cout << "EncryptingÖ ";
crypt();
}
// [Main Task Block]
int main(void)
{ inType type = promptU();
type == UFILE ? inFile() : inString(); //doesn't work??
return 0;
}
I am starting a cryptography program in C++, but have hit a snag with my linker. Any time I try to compile the backbone of the program, I get about six "link error: undefined symbol ... " errors.
This is the first time I have seen these errors from the software I use (Metrowerks Code Warrior).
Source:
/* Author: teufelfisch
Filename: "test.cpp"
Last Mod: 5/22/02 */
// [Includes]
#include <iostream>
#include <fstream>
#include "./stuff/apstring.h"
using namespace std;
// [Classes]
enum inType { UFILE, STRING };
// [Prototypes]
void crypt(); //Actual cryptography SR
inType promptU(); //Prompts user for type: read from string or file
void inString(); //Gets string from user to be crypted
void inFile(); //Reads file to be crypted
// [Definitions]
inType promptU()
{ char marm;
inType retType;
bool exitFlag = true;
do
{ cout << endl << "Type of input (f/s): ";
cin >> marm;
marm = toupper(marm);
if (marm == 'F')
retType = UFILE;
else
{ if (marm == 'S')
retType = STRING;
else
{ cout << endl << "Invalid type. Please specify file or string.";
exitFlag = false; }
}
}
while (exitFlag == false);
return retType;
}
void inString()
{ apstring ustring;
cout << endl << "Please type the text to be encrypted." << endl;
getline(cin, ustring);
cout << "EncryptingÖ ";
crypt();
}
// [Main Task Block]
int main(void)
{ inType type = promptU();
type == UFILE ? inFile() : inString(); //doesn't work??
return 0;
}