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 :

unable to create variable object


Sujet :

C++

  1. #1
    Membre du Club Avatar de Batou
    Inscrit en
    Mars 2004
    Messages
    71
    Détails du profil
    Informations forums :
    Inscription : Mars 2004
    Messages : 71
    Points : 62
    Points
    62
    Par défaut unable to create variable object
    Bonjour,

    Je commence a programmer un petit programme avec seulement 2 classes, et un main. Cependant, ca ne marche pas.
    Sous Eclipse, les erreurs qui apparaissent sont :
    A syntax error in expression, near `::__ioinit'.
    mi_cmd_var_create: unable to create variable object
    whatis fData::memory
    A syntax error in expression, near `memory'.
    A syntax error in expression, near `memory'.
    mi_cmd_var_create: unable to create variable object
    Les grosses lignes de mon code sont :
    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
    148
    149
    150
    #include <stdio.h>
    #include <windows.h>
    #include <string>
    #include <iostream>
    #include "MF.h"
    using namespace std;
    using std::string;
     
    class fMemory {
     public:
      unsigned char bytememory[64];
      unsigned int frontindex; // to store all data except signs at the beginning of chip
      unsigned int backindex; // to store signs at the end of chip
      unsigned int availablebit;
      bool memoryexceeded;
      fMemory();
      unsigned char * getByteMemory();
      void setByteMemory(unsigned char * b);
      void initializeByteMemory();
      bool getBit(unsigned int byteI, unsigned int bitI);
      void setBit(unsigned int byteI, unsigned int bitI, bool b);
      friend class fData;
    };
     
    fMemory::fMemory() {
      frontindex = 0;
      backindex = 63;
      availablebit = 0;
      memoryexceeded = false;
    }
     
    void connectF(unsigned char * bytememory, char * arg, unsigned char * b) {
    ...
    }
     
    unsigned char * fMemory::getByteMemory() {
    ...
    }
     
    void fMemory::setByteMemory(unsigned char * b) {
    ...
    }
     
    void fMemory::initializeByteMemory() {
    ...
    }
     
    bool fMemory::getBit(unsigned int byteI, unsigned int bitI) {
    ...
    }
     
    void fMemory::setBit(unsigned int byteI, unsigned int bitI, bool b) {
    ...
    }
     
    class fData {
      static fMemory * memory; // the memory allocated for ALL the data
      unsigned int dataindex; // the place of the first byte
      unsigned int signbyteindex; // byte where the sign is stored
      unsigned int signbitindex; // byte's bit where the sign is stored
      unsigned int usedbytes; // number of bytes used
      bool readwrite; // allow the reading/writing
     public:
      fData(string, string);
      unsigned char * getValue();
      void setValue(unsigned char *);
      bool getSign();
      void setSign(bool);
      unsigned char * numberToBytes(long);
      long bytesToNumber(unsigned char *);
      void modifyValue(string, fData *);
      friend ostream& operator<<(ostream&, fData);
    };
     
    fMemory * fData::memory;
     
    fData::fData(string dt, string rw) {
      // make data reference equal to reference
      if (dt == "short")
        if ((2 + memory->frontindex) < memory->backindex)
          usedbytes = 2;
        else
          throw "memory exceeded";
      else if (dt == "int")
        if (4 + memory->frontindex < memory->backindex)
          usedbytes = 4;
        else
          throw "memory exceeded";
      else if (dt == "long")
        if (8 + memory->frontindex < memory->backindex)
          usedbytes = 8;
        else
          throw "memory exceeded";
      dataindex = memory->frontindex;
      memory->frontindex += usedbytes; // to slide the back index for next data
      // allow RW or not
      if (rw == "RW")
        readwrite = true;
      else
        readwrite = false;
      // store the sign at the end of the chip
      signbyteindex = memory->backindex;
      signbitindex = memory->availablebit;
      memory->availablebit++;
      if (memory->availablebit == 4) {
        memory->backindex--;
        memory->availablebit = 0;
      }
    }
     
    unsigned char * fData::getValue() {
    ...
    }
     
    void fData::setValue(unsigned char * v) {
    ...
    }
     
    bool fData::getSign() { // true = "<0", false = ">0"
    ...
    }
     
    void fData::setSign(bool s) { // true = "<0", false = ">0"
    ...
    }
     
    long fData::bytesToNumber(unsigned char * b) {
    ...
    }
     
    unsigned char * fData::numberToBytes(long v) {
    ...
    }
     
    void fData::modifyValue(string operation, fData * f) {
    ...
    }
     
    ostream& operator<<(ostream &o, fData fd) {
    ...
    }
     
    int main (int argv, char *argc[]) {
      fData * d = new fData("int", "rw");
      cout << "this is a fData: " << d << "\n";
      printf( "Press key.\n" );
      getchar();
      printf("test ok!\n");
      return EXIT_SUCCESS;
    }
    Je continue a chercher, mais si un expert pouvait m'eclairer, ca irai plus vite !



    Merci d'avance,
    Batou
    "It has to start somewhere, It has to start sometime.
    What better place than here, what better time than now?
    " [RATM]

  2. #2
    Membre du Club Avatar de Batou
    Inscrit en
    Mars 2004
    Messages
    71
    Détails du profil
    Informations forums :
    Inscription : Mars 2004
    Messages : 71
    Points : 62
    Points
    62
    Par défaut
    En modifiant 2 lignes, ca marche !

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    fMemory * fData::memory = new fMemory();
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     public:
      static fMemory * memory; // the memory allocated for ALL the data
    (avant il etait prive)
    "It has to start somewhere, It has to start sometime.
    What better place than here, what better time than now?
    " [RATM]

  3. #3
    Rédacteur

    Avatar de Matthieu Brucher
    Profil pro
    Développeur HPC
    Inscrit en
    Juillet 2005
    Messages
    9 810
    Détails du profil
    Informations personnelles :
    Âge : 42
    Localisation : France, Pyrénées Atlantiques (Aquitaine)

    Informations professionnelles :
    Activité : Développeur HPC
    Secteur : Industrie

    Informations forums :
    Inscription : Juillet 2005
    Messages : 9 810
    Points : 20 970
    Points
    20 970
    Par défaut
    Normal

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

Discussions similaires

  1. [COM] Failed to create COM object word.application: Accès refusé
    Par groovyroe dans le forum Bibliothèques et frameworks
    Réponses: 2
    Dernier message: 10/05/2009, 17h46
  2. ORA-01658: unable to create INITIAL extent for segment in tablespace
    Par farenheiit dans le forum Administration
    Réponses: 11
    Dernier message: 05/06/2007, 17h49
  3. Initialisation d'une variable Object
    Par bobic dans le forum Langage
    Réponses: 2
    Dernier message: 08/09/2006, 17h21
  4. Réponses: 4
    Dernier message: 21/11/2005, 12h04
  5. unable to create INITIAL extent for segment in tablespace
    Par Ludolitaliano dans le forum Administration
    Réponses: 4
    Dernier message: 11/09/2003, 16h43

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