[COMPILATION ERROR]types multiples dans une déclaration
bonjour, depuis un certain temps, j'ai cette erreur que je n'arrive pas a trouvé.
Code:
1 2 3 4
|
g++ -o ArguLine.o -c ArguLine.cpp -Wall -ansi
General.hpp:42: erreur: types multiples dans une déclaration
make: *** [ArguLine.o] Erreur 1 |
or a la ligne 42 de general.hpp j'ai ca }; // voir en dessous dans le code
voici mon fichier General.hpp
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
|
#ifndef GENERAL_H
#define GENERAL_H
#include "Singleton.hpp"
#include <string>
#define STATIC 0
#define DYNAMIQUE 1
#define GRAHAM 0
#define JARVIS 1
#define CHAN 2
#define UNIFORM 0
#define TOUSSAIN 1
class CGeneral: public CSingleton<CGeneral>{
friend class CSingleton<CGeneral>;
public:
int typealgo ; //dynamiqye/statique
int nline;
int nboucle;
int algo;
bool time;
bool help;
int create;
std::string path;
CGeneral(){
typealgo = -1;
nline = -1;
nboucle = -1;
algo = -1;
time = 0;
help = 0;
path = "";
create = -1;
}
};//ligne 42
#define GENERAL CGeneral::instance()
struct Delete
{
template <class T> void operator ()(T*& p) const
{
delete p;
p = NULL;
}
};
struct Print
{
template <class T> void operator ()(T*& p) const
{
if (p!=NULL) p->print();
}
};
#endif |
et voici la classe arguline(ainsi que cpp)
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
|
#ifndef ARGUMENT_LINE_HPP
#define ARGUMENT_LINE_HPP
#include "Singleton.hpp"
class CArguLine : public CSingleton<CArguLine>{
friend class CSingleton<CArguLine>;
private:
int CArguLine::changeStringtoN(const std::string& n);
void CArguLine::printHelp();
bool CheckArgu();
public:
bool GetArgu(int argc,char** argv);
~CArguLine(){};
}
#endif |
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92
|
#include "ArguLine.hpp"
#include "General.hpp"
#include <sstream>
bool CArguLine::GetArgu(int argc,char** argv){
for(int i = 1; i <argc; i++){
if(strcmp(argv[i],"-typealgo")==0){
++i;
if(strcmp(argv[i],"Dyn")==0) GENERAL.typealgo = DYNAMIQUE;
else if(strcmp(argv[i],"Sta" )==0)GENERAL.typealgo = STATIC;
else {
std::cout << "ERROR: "<< argv[i] << "NON RECONNU" << std::endl;
std::cout << "-typealgo peut prendre Dyn ou Stat" << std::endl << std:: endl;
}
}
if(strcmp(argv[i],"-create")==0){
++i;
if(strcmp(argv[i],"uniform")==0)
GENERAL.create = UNIFORM;
else if(strcmp(argv[i],"toussain" )==0)
GENERAL.create = TOUSSAIN;
else {
std::cout << "ERROR: "<< argv[i] << "NON RECONNU" << std::endl;
std::cout << "-create Uniform ou Toussain" << std::endl << std:: endl;
}
}
else if(strcmp(argv[i],"-nline")==0)
GENERAL.nline = changeStringtoN(argv[++i]);
else if(strcmp(argv[i],"-nboucle")==0)
GENERAL.nboucle = changeStringtoN(argv[++i]);
else if(strcmp(argv[i],"-export")==0)
GENERAL.path = argv[++i];
else if(strcmp(argv[i],"-algo")==0){
++i;
if(strcmp(argv[i],"graham")==0)GENERAL.algo = GRAHAM;
else if(strcmp(argv[i],"jarvis" )==0)GENERAL.algo = JARVIS;
else if(strcmp(argv[i],"chan" )==0)GENERAL.algo = CHAN;
else {
std::cout << "ERROR: "<< argv[i] << "NON RECONNU" << std::endl;
std::cout << "-algo peut prendre graham,jarvis ou chan" << std::endl << std::endl;
}
}else if(strcmp(argv[i],"-time")==0)GENERAL.time = 1 ;
else if(strcmp(argv[i],"-help")==0){
GENERAL.help = 1 ;
printHelp();
}
}
return CheckArgu();
}
void CArguLine::printHelp(){
std::cout << std::cout << "-typealgo Dyn / Stat" << std::endl << std:: endl;
std::cout << std::cout << "-nline 100" << std::endl << std:: endl;
std::cout << std::cout << "-nboucle 100" << std::endl << std:: endl;
std::cout << std::cout << "-export data.txt" << std::endl << std:: endl;
std::cout << std::cout << "-algo graham/jarvis/chan" << std::endl << std:: endl;
std::cout << std::cout << "-create uniform/toussain" << std::endl << std:: endl;
std::cout << std::cout << "-time" << std::endl << std:: endl;
}
bool CArguLine::CheckArgu(){
if( GENERAL.typealgo == -1 || GENERAL.nline == -1 ||
GENERAL.nboucle == -1 || GENERAL.algo == -1 || GENERAL.create == -1 ){
printHelp();
return false;
}
if( GENERAL.path == "" ) GENERAL.path ="data.txt";
return true;
}
int CArguLine::changeStringtoN(const std::string& n)
{
std::istringstream iss( n );
int nombre;
iss >> nombre;
return nombre;
} |
sii qnn pourrai m'eclairer, merci
a++