Bonjour,
je suis débutant C++, et je suis perdu malgré les FAQ dans les appels à mes fichiers cpp et hpp...
Voici le schéma de mon programme :
Un fichier index.cpp qui contient le main et qui fait appel à deux classes :
- DrosoGenomicExperiment
- DrosoSeqExperiment
L'entête de main.cpp :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3 #include "DrosoGenomic.hpp" #include "DrosoSeq.hpp" #include <iostream>
Ma classe DrosoGenomicExperiment définie dans DrosoGenomic.hpp et DrosoGenomic.cpp avec comme entête dans DrosoGenomic.cpp :
et Ma classe DrosoSeqExperiment définie par les deux fichiers DrosoSeq.hpp et DrosoSeq.cpp avec comme entête pour DrosoSeq.cpp :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6 #include "DrosoGenomic.hpp" #include <fstream> #include <iostream> #include <string> #include <stdio.h> #include <stdlib.h>
La classe DrosoSeqExperiment contient comme attributs deux objets de classe DrosoGenomicExperiment
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3 #include "DrosoSeq.hpp" #include "DrosoGenomic.hpp"
A la compilation, j'ai des erreurs de mon éditeur depuis que j'ai créé ma classe DrosoSeqExperiment.
Voici les fichiers hpp :
DrosoGenomic.hpp
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 #include <stdio.h> #include <string> using namespace std; class DrosoGenomicExperiment { public: //constructeur DrosoGenomicExperiment(string label){ chr2L = new float[23011544]; chr2R = new float[21146708]; chr3L = new float[24543557]; chr3R = new float[27905053]; chr4 = new float[1351857]; chrU = new float[10049037]; chrX = new float[22422827]; name = label; } //destructeur ~DrosoGenomicExperiment(){ delete chr2L; delete chr2R; delete chr3L; delete chr4; delete chrU; delete chrX; } //méthodes string getname(){ return name; }//Give name of object bool save(string path);//Save data in a text file. True if it works bool restore(string path);//Restore data from a text file. True if it works bool load_bed_MGX(string path,int strand);//Load data from a bed file produced by MGX. True if it works void extend(int nbnuc);//extend the counts to nbnuc nucleotides, with positive direction bool CreateGraphData(string chrom, int start, int stop, string GraphData);//Generate File data for GNUPlot void CreateGraph(string chrom, int start, int stop, string GraphFile, string Title);//draw the chromosome chrom from start to stop //variables float *chr2L;//23011544 float *chr2R;//21146708 float *chr3L;//24543557 float *chr3R;//27905053 float *chr4;//1351857 float *chrU;//10049037 float *chrX;//22422827 string name; };
et DrosoSeq.hpp :
Merci d'avance pour votre aide
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 #include <stdio.h> #include <string> #include <vector> using namespace std; class DrosoSeqExperiment{ public: //constructeur DrosoSeqExperiment(string label){ string labelforward = label + "_forward"; string labelreverse = label + "_reverse"; DrosoGenomicExperiment forward = DrosoGenomicExperiment(labelforward); DrosoGenomicExperiment reverse = DrosoGenomicExperiment(labelreverse); name = label; } //destructeur //méthodes //variables string name; DrosoGenomicExperiment forward; DrosoGenomicExperiment reverse; };
Partager