Bonjour à tous, j'espere que l'un d'entre vous poura résoudre mon problème.
Voici donc mon pb:

helpers.h

#ifndef _HELPERS_H
# define _HELPERS_H
#include <string>

long strToLong(std::string const &a, int b);
long strToLongDef(std::string const c, int d, int e=0);
double strToDouble(std::string const f);
std::string soundEx(std::string const g);

#endif /* !_HELPERS_H */


helpers.cpp

#include <iostream>
#include <string>
#include "helpers.h"

using std::cout;
using std::endl;

long strToLong(std::string const &chaine,int base=0) {
char * pEnd;
long result = strtol(chaine.c_str(),&pEnd,base);
return result;
}

long strToLongDef(std::string const & chaine,int defaut,int base=0) {
char * pEnd;
long result = strtol(chaine.c_str(),&pEnd,base);
if(result==0 && chaine!="0")
return defaut;
else
return result;
}

double strToDouble(std::string const & chaine) {
char * pEnd;
return strtod(chaine.c_str(),&pEnd);
}

std::string soundEx(std::string const & chaine) {
std::string result="";
unsigned int indexChaine=0;
int indexResult=0;
std::string lettre="";
if(chaine[indexChaine]!='\0') {
if(chaine[indexChaine]>='a' & chaine[indexChaine]<='z') {
result += chaine[indexChaine++]-'a'+'A';
}
else {
result += chaine[indexChaine++];
}
indexResult++;
}
else {
result+='0';
}
for(indexChaine=0;indexChaine<chaine.size()&&result.size()<4;indexChaine++) {
char lettre;
if(chaine[indexChaine]>='a' & chaine[indexChaine]<='z') {
lettre = chaine[indexChaine]-'a'+'A';
}
else {
lettre = chaine[indexChaine];
}
switch(lettre) {
case 'A':
case 'E':
case 'I':
case 'O':
case 'U':
case 'Y':
case 'H':
case 'W':
break;
case 'B':
case 'F':
case 'P':
case 'V':
if(result[indexResult]!='1')
result+="1";
break;
case 'C':
case 'G':
case 'J':
case 'K':
case 'Q':
case 'S':
case 'X':
case 'Z':
if(result[indexResult]!='2')
result+="2";
break;
case 'D':
case 'T':
if(result[indexResult]!='3')
result+="3";
break;
case 'L':
if(result[indexResult]!='4')
result+="4";
break;
case 'M':
case 'N':
if(result[indexResult]!='5')
result+="5";
break;
case 'R':
if(result[indexResult]!='6')
result+="6";
break;
}
}
if(result.size()<=4) {
for(unsigned i=result.size();i<4;i++) {
result+='0';
}
}
return result;
}


main.cpp

#include <iostream>
#include <string>
#include "helpers.h"
using std::cout;
using std::endl;
using std::string;

int main(void) {
cout << strToLong("1234", 10) << endl;
cout << strToLongDef("0x2a", -1) << endl;
cout << strToDouble("143.17") << endl;
cout << soundEx("Robert") << endl;
return 0;
}




Voici ce que j'obtiens en faisant:
g++ -O2 -Wall -W -Werror -O2 main.cpp -o main
/tmp/ccg2wa36.o: In function `main':
main.cpp.text+0xac): undefined reference to `strToLong(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)'
main.cpp.text+0x109): undefined reference to `strToLongDef(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, int)'
main.cpp.text+0x152): undefined reference to `strToDouble(std::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
main.cpp.text+0x1a2): undefined reference to `soundEx(std::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
collect2: ld returned 1 exit status
make: *** [main] Error 1

Si quelqu'un pouvait m'aider ca sera sympa
merci d'avance