Jump to content
View in the app

A better way to browse. Learn more.

Next

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

[résolu][CPP] problème template

Featured Replies

Bonjour,

J'ai un problème avec Dev-c++ (GCC) Lorsque je compile ça (il ce trouve dans le .h) et aucune instruction ne le précède :

#ifndef _TRANSLATE_H_
#define _TRANSLATE_H_

#include <deque>

class Trans_phrase {
 public:
char* pNom;
char* pPhrase;
//bool est(char* nom);
};

class Translator {
 private:
deque<Trans_phrase> pPhrases;

 public:
void loadfile(char* fichier);
//void strcpy(char* dest, const char* nom);
//void strcat(char* dest, const char* nom);
};

#endif

J'obtiens :

ISO C++ forbids declaration of `deque' with no type 
expected `;' before '<' token 
In member function `void Translator::loadfile(char*)': 

Je trouve ça très bizarre car c'est une simple template.

Edited by RaphAstronome

pas d'using namespace dans un fichier hpp.

Précise le préfixe (eg: std::deque<Trans_phrase> pPhrases;) directement.

Là, tous ceux qui inclueront ton .hpp se taperont un namespace sans forcément en avoir besoin ni l'avoir voulu

  • Author

pas d'using namespace dans un fichier hpp.

Précise le préfixe (eg: std::deque<Trans_phrase> pPhrases;) directement.

Là, tous ceux qui inclueront ton .hpp se taperont un namespace sans forcément en avoir besoin ni l'avoir voulu

Peut t'on faire comme ça ?

{
 using namespace std;
 // Code
}

Archived

This topic is now archived and is closed to further replies.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.