James78
June 3rd, 2010, 07:56 AM
Any idea as to why it's doing this too me? :(
Error:
/home/acidburn/Projects/rsuploader/src/main.cpp:69: undefined reference to `poptGetContext'
/home/acidburn/Projects/rsuploader/src/main.cpp:72: undefined reference to `poptGetNextOpt'
/home/acidburn/Projects/rsuploader/src/main.cpp:115: undefined reference to `poptStrerror'
/home/acidburn/Projects/rsuploader/src/main.cpp:115: undefined reference to `poptBadOption'
/home/acidburn/Projects/rsuploader/src/main.cpp:119: undefined reference to `poptFreeContext'
main.cpp
#include "functions.h"
#include "parseargs.h"
#include <popt.h>
#include <cstdio>
#include <iostream>
using namespace std;
int main(int argc, char* argv[])
{
const int realNumberArgs = argc - 1;
const bool hasArgs = (realNumberArgs == 0);
if (hasArgs) {
printUsage(0);
return 1;
}
// Declare popt options variables..
char login[65]; // RS max username length is 64
char password[31]; // RS max pass length is 30
char* uploadPath,* accountType,* writeToFile;
int antiHack;
//int updateMode, trashMode;
//Set popt options
poptContext optCon;
poptOption optionsTable[] = {
{ "help", 'h', 0, '\0', 'h', '\0', '\0' },
{ "help-all", 'H', 0, '\0', 'H', '\0', '\0' },
{ "account-type", 'a', POPT_ARG_STRING, &accountType, 0, '\0', '\0' },
{ "disclaimer", 'd', 0, '\0', 'd', '\0', '\0' },
{ "upload", 'f', POPT_ARG_STRING, &uploadPath, 0, '\0', '\0' },
{ "login", 'l', POPT_ARG_STRING, &login, 0, '\0', '\0' },
{ "password", 'p', POPT_ARG_STRING, &password, 0, '\0', '\0' },
{ '\0', 'v', 0, '\0', 'v', '\0', '\0' },
{ "anti-hack", 'A', POPT_ARG_INT, &antiHack, 0, '\0', '\0' },
{ "create-account", 'c', 0, '\0', 'c', '\0', '\0' },
//{ "trash-mode", 't', POPT_ARG_INT, &trashMode, 0, '\0', '\0' },
//{ "update-mode", 'u', POPT_ARG_INT, &updateMode, 0, '\0', '\0' },
{ "write", 'w', POPT_ARG_STRING, &writeToFile, 0, '\0','\0' },
{ "points", 'y', 0, '\0', 0, '\0', '\0' },
{ '\0', 0, 0, '\0', 0, '\0', '\0' }
};
optCon = poptGetContext("rsuploader", argc, (const char**)argv, (const struct poptOption*)&optionsTable, 0);
char c;
while ((c = poptGetNextOpt(optCon)) > 0) {
switch (c) {
case 'h' :
printUsage(0);
break;
case 'H' :
printUsage(1);
break;
case 'a' :
break;
case 'd' :
break;
case 'f' :
break;
case 'l' :
break;
case 'p' :
break;
case 'v' :
break;
case 'A' :
break;
case 'c' :
break;
case 'w' :
break;
case 'y' :
break;
}
}
if (c < -1) {
// an error occurred during option processing
fprintf(stderr, "%s: %s\n", poptBadOption(optCon, POPT_BADOPTION_NOALIAS), poptStrerror(c));
return 1;
}
poptFreeContext(optCon);
return 0;
}
Error:
/home/acidburn/Projects/rsuploader/src/main.cpp:69: undefined reference to `poptGetContext'
/home/acidburn/Projects/rsuploader/src/main.cpp:72: undefined reference to `poptGetNextOpt'
/home/acidburn/Projects/rsuploader/src/main.cpp:115: undefined reference to `poptStrerror'
/home/acidburn/Projects/rsuploader/src/main.cpp:115: undefined reference to `poptBadOption'
/home/acidburn/Projects/rsuploader/src/main.cpp:119: undefined reference to `poptFreeContext'
main.cpp
#include "functions.h"
#include "parseargs.h"
#include <popt.h>
#include <cstdio>
#include <iostream>
using namespace std;
int main(int argc, char* argv[])
{
const int realNumberArgs = argc - 1;
const bool hasArgs = (realNumberArgs == 0);
if (hasArgs) {
printUsage(0);
return 1;
}
// Declare popt options variables..
char login[65]; // RS max username length is 64
char password[31]; // RS max pass length is 30
char* uploadPath,* accountType,* writeToFile;
int antiHack;
//int updateMode, trashMode;
//Set popt options
poptContext optCon;
poptOption optionsTable[] = {
{ "help", 'h', 0, '\0', 'h', '\0', '\0' },
{ "help-all", 'H', 0, '\0', 'H', '\0', '\0' },
{ "account-type", 'a', POPT_ARG_STRING, &accountType, 0, '\0', '\0' },
{ "disclaimer", 'd', 0, '\0', 'd', '\0', '\0' },
{ "upload", 'f', POPT_ARG_STRING, &uploadPath, 0, '\0', '\0' },
{ "login", 'l', POPT_ARG_STRING, &login, 0, '\0', '\0' },
{ "password", 'p', POPT_ARG_STRING, &password, 0, '\0', '\0' },
{ '\0', 'v', 0, '\0', 'v', '\0', '\0' },
{ "anti-hack", 'A', POPT_ARG_INT, &antiHack, 0, '\0', '\0' },
{ "create-account", 'c', 0, '\0', 'c', '\0', '\0' },
//{ "trash-mode", 't', POPT_ARG_INT, &trashMode, 0, '\0', '\0' },
//{ "update-mode", 'u', POPT_ARG_INT, &updateMode, 0, '\0', '\0' },
{ "write", 'w', POPT_ARG_STRING, &writeToFile, 0, '\0','\0' },
{ "points", 'y', 0, '\0', 0, '\0', '\0' },
{ '\0', 0, 0, '\0', 0, '\0', '\0' }
};
optCon = poptGetContext("rsuploader", argc, (const char**)argv, (const struct poptOption*)&optionsTable, 0);
char c;
while ((c = poptGetNextOpt(optCon)) > 0) {
switch (c) {
case 'h' :
printUsage(0);
break;
case 'H' :
printUsage(1);
break;
case 'a' :
break;
case 'd' :
break;
case 'f' :
break;
case 'l' :
break;
case 'p' :
break;
case 'v' :
break;
case 'A' :
break;
case 'c' :
break;
case 'w' :
break;
case 'y' :
break;
}
}
if (c < -1) {
// an error occurred during option processing
fprintf(stderr, "%s: %s\n", poptBadOption(optCon, POPT_BADOPTION_NOALIAS), poptStrerror(c));
return 1;
}
poptFreeContext(optCon);
return 0;
}