IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

C++ Discussion :

variable 'std::ofstream outFile1' has initializer but incomplete type


Sujet :

C++

  1. #1
    Membre averti
    Profil pro
    Inscrit en
    Février 2010
    Messages
    25
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Février 2010
    Messages : 25
    Par défaut variable 'std::ofstream outFile1' has initializer but incomplete type
    Bonjour à tous,

    Je suis entrain de débuter sur c++, mon objectif est d'utiliser une bibliothèque de résolution d'équations différentielles. Je suis entrain d'utiliser des exemples déjà présents en essayant de modifier de contenu de la façon qui me convient.
    Voici le code que j'ai essayé d'exécuter (j'ai eu droit à l'erreur: variable 'std::ofstream outFile1' has initializer but incomplete type) :

    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
    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
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    /*27:*/
    #line 80 "./lotkavolterra2.w"
     
    #include <ostream>
    #include "vnode.h"
    using namespace std;
    using namespace vnodelp;
     
    /*20:*/
    #line 6 "./lotkavolterra2.w"
     
    /*19:*/
    #line 76 "./usage.w"
     
    template<typename var_type>
    void lotkavolterra2(int n,var_type*yp,
                       const var_type*y,
                       var_type t,void*param)
    {
     
        yp[0]= (1-0.01*y[1])*y[0];
        yp[1]= (-1+0.02*y[0])*y[1];
     
    }
     
     
    #line 1 "./lotkavolterra2.w"
     
    /*:19*/
    #line 7 "./lotkavolterra2.w"
     
    int main()
    {
     
        /*21:*/
    #line 24 "./lotkavolterra2.w"
     
        const int n= 2;
        interval t= 0.0,tend= 2;
        iVector y(n);
     
    //interval ci1 = interval(49.5, 50.5);
    //interval ci2 = interval(49.5, 50.5);
    //y[0]= ci1;
    //y[1]= ci2;
     
        y[0]= 50.0;
        y[1]= 50.0;
     
     
     
     
     
     
        /*:21*/
    #line 10 "./lotkavolterra2.w"
     
        /*22:*/
    #line 41 "./lotkavolterra2.w"
     
        AD*ad= new FADBAD_AD(n,lotkavolterra2,lotkavolterra2);
     
     
     
        /*:22*/
    #line 11 "./lotkavolterra2.w"
     
        /*23:*/
    #line 48 "./lotkavolterra2.w"
     
        VNODE*Solver= new VNODE(ad);
     
     
     
        /*:23*/
    #line 12 "./lotkavolterra2.w"
     
        /*24:*/
    #line 57 "./lotkavolterra2.w"
     
    interval step= string_to_interval("0.1");
     
    tend= 0.0;
    for(int i= 1;i<=20;i++)
    {
    tend+= step;
    Solver->integrate(t,y,tend);
    /*26:*/
    #line 67 "./basic.w"
     
    ofstream outFile1("lorenz.tight",ios::out);
    outFile1<<"Solution enclosure at t = "<<t<<endl<<"\t";
     
    cout<<"Solution enclosure at t = "<<t<<endl;
    printVector(y);
     
     
     
     
    /*:26*/
    #line 19 "./intermed.w"
     
    }
     
    tend= 2.1;
     
    Solver->integrate(t,y,tend);
    /*26:*/
    #line 67 "./basic.w"
     
    cout<<"Solution enclosure at t = "<<t<<endl;
    printVector(y);
     
        /*:24*/
    #line 13 "./lotkavolterra2.w"
     
        /*25:*/
    #line 62 "./lotkavolterra2.w"
     
        if(!Solver->successful())
            cout<<"VNODE-LP could not reach t = "<<tend<<endl;
     
        /*:25*/
    #line 14 "./lotkavolterra2.w"
     
        /*26:*/
    #line 67 "./lotkavolterra2.w"
     
        cout<<"Solution enclosure at t = "<<t<<endl;
        printVector(y);
     
     
     
     
        /*:26*/
    #line 15 "./lotkavolterra2.w"
     
        return 0;
    }
     
    /*:20*/
    #line 86 "./lotkavolterra2.w"
     
     
     
     
    /*:27*/
    Merci d'avance pour votre aide,

  2. #2
    Responsable 2D/3D/Jeux


    Avatar de LittleWhite
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Mai 2008
    Messages
    27 052
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Ingénieur développement logiciels

    Informations forums :
    Inscription : Mai 2008
    Messages : 27 052
    Billets dans le blog
    140
    Par défaut
    Bonjour,

    Vous n'utilisez pas le bon include pour le std::ofstream.
    Comme indiquer dans la documentation, il faut inclure:
    et non
    Vous souhaitez participer à la rubrique 2D/3D/Jeux ? Contactez-moi

    Ma page sur DVP
    Mon Portfolio

    Qui connaît l'erreur, connaît la solution.

  3. #3
    Membre averti
    Profil pro
    Inscrit en
    Février 2010
    Messages
    25
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Février 2010
    Messages : 25
    Par défaut
    ça marche à merveille !! grand merci !

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Réponses: 16
    Dernier message: 04/03/2015, 12h00
  2. Réponses: 4
    Dernier message: 16/03/2014, 00h04
  3. has initializer but incomplete type
    Par laflak dans le forum C
    Réponses: 3
    Dernier message: 25/03/2008, 18h05
  4. Réponses: 3
    Dernier message: 23/01/2008, 16h04
  5. has incomplete type,forward declaration of ,
    Par Pragmateek dans le forum C++
    Réponses: 12
    Dernier message: 22/07/2006, 15h03

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo