Contenu | Rechercher | Menus

Annonce

Si vous avez des soucis pour rester connecté, déconnectez-vous puis reconnectez-vous depuis ce lien en cochant la case
Me connecter automatiquement lors de mes prochaines visites.

À propos de l'équipe du forum.

#1 Le 07/03/2012, à 17:14

Noureddine-BOUBAKER

error: ‘TCHAR’ was not declared in this scope

Dé que je compile mon programme l'erreur suivant apparue: error: "‘TCHAR’ was not declared in this scope"
alors que tchar est definit dans le fichier winnt.h sous : /usr/i586-mingw32msvc/include
Comment doit faire pour que le fichier serait reconnu par le compilateur!!!!

Hors ligne

#2 Le 07/03/2012, à 17:25

Haleth

Re : error: ‘TCHAR’ was not declared in this scope


Ubuntu is an ancien African word which means "I can't configure Debian"

Because accessor & mutator are against encapsulation (one of OOP principles), good OOP-programmers do not use them. Obviously, procedural-devs do not. In fact, only ugly-devs are still using them.

Hors ligne

#3 Le 07/03/2012, à 19:30

Noureddine-BOUBAKER

Re : error: ‘TCHAR’ was not declared in this scope

j'ai tapé  g++ -o StdAfx StdAfx.cpp -I /usr/i586-mingw32msvc/include/
alors que  mm problm yikes,

In file included from /usr/include/c++/4.4/bits/postypes.h:42,
                 from /usr/include/c++/4.4/iosfwd:42,
                 from /usr/include/c++/4.4/ios:39,
                 from /usr/include/c++/4.4/ostream:40,
                 from /usr/include/c++/4.4/iostream:40,
                 from StdAfx.cpp:6:
/usr/include/c++/4.4/cwchar:145: error: ‘::fgetws’ has not been declared
/usr/include/c++/4.4/cwchar:147: error: ‘::fputws’ has not been declared
/usr/include/c++/4.4/cwchar:151: error: ‘::getwc’ has not been declared
/usr/include/c++/4.4/cwchar:152: error: ‘::getwchar’ has not been declared
/usr/include/c++/4.4/cwchar:157: error: ‘::putwc’ has not been declared
/usr/include/c++/4.4/cwchar:158: error: ‘::putwchar’ has not been declared
In file included from /usr/include/c++/4.4/bits/localefwd.h:42,
                 from /usr/include/c++/4.4/ios:42,
                 from /usr/include/c++/4.4/ostream:40,
                 from /usr/include/c++/4.4/iostream:40,
                 from StdAfx.cpp:6:
/usr/include/c++/4.4/i686-linux-gnu/bits/c++locale.h:52: error: ‘uselocale’ was not declared in this scope
/usr/include/c++/4.4/i686-linux-gnu/bits/c++locale.h:52: error: invalid type in declaration before ‘;’ token
/usr/include/c++/4.4/i686-linux-gnu/bits/c++locale.h:59: error: ‘__locale_t’ does not name a type
/usr/include/c++/4.4/i686-linux-gnu/bits/c++locale.h:66: error: expected ‘,’ or ‘...’ before ‘&’ token
/usr/include/c++/4.4/i686-linux-gnu/bits/c++locale.h: In function ‘int std::__convert_from_v(int)’:
/usr/include/c++/4.4/i686-linux-gnu/bits/c++locale.h:72: error: expected ‘;’ before ‘__old’
/usr/include/c++/4.4/i686-linux-gnu/bits/c++locale.h:86: error: ‘__fmt’ was not declared in this scope
/usr/include/c++/4.4/i686-linux-gnu/bits/c++locale.h:89: error: ‘__out’ was not declared in this scope
/usr/include/c++/4.4/i686-linux-gnu/bits/c++locale.h:89: error: ‘__size’ was not declared in this scope
/usr/include/c++/4.4/i686-linux-gnu/bits/c++locale.h:97: error: ‘__old’ was not declared in this scope
/usr/include/c++/4.4/i686-linux-gnu/bits/c++locale.h:97: error: ‘__gnu_cxx::__uselocale’ cannot be used as a function
In file included from /usr/include/sched.h:34,
                 from /usr/include/pthread.h:25,
                 from /usr/include/c++/4.4/i686-linux-gnu/bits/gthr-default.h:41,
                 from /usr/include/c++/4.4/i686-linux-gnu/bits/gthr.h:162,
                 from /usr/include/c++/4.4/ext/atomicity.h:34,
                 from /usr/include/c++/4.4/bits/ios_base.h:41,
                 from /usr/include/c++/4.4/ios:43,
                 from /usr/include/c++/4.4/ostream:40,
                 from /usr/include/c++/4.4/iostream:40,
                 from StdAfx.cpp:6:
/usr/i586-mingw32msvc/include/time.h: At global scope:
/usr/i586-mingw32msvc/include/time.h:187: error: expected constructor, destructor, or type conversion before ‘char’
In file included from /usr/include/c++/4.4/bits/ios_base.h:43,
                 from /usr/include/c++/4.4/ios:43,
                 from /usr/include/c++/4.4/ostream:40,
                 from /usr/include/c++/4.4/iostream:40,
                 from StdAfx.cpp:6:
/usr/include/c++/4.4/bits/locale_classes.h:344: error: ‘__c_locale’ does not name a type
/usr/include/c++/4.4/bits/locale_classes.h:375: error: ‘__c_locale’ has not been declared
/usr/include/c++/4.4/bits/locale_classes.h:376: error: ‘__c_locale’ has not been declared
/usr/include/c++/4.4/bits/locale_classes.h:378: error: ‘__c_locale’ does not name a type
/usr/include/c++/4.4/bits/locale_classes.h:382: error: ‘__c_locale’ has not been declared
/usr/include/c++/4.4/bits/locale_classes.h:386: error: ‘__c_locale’ does not name a type
/usr/include/c++/4.4/bits/locale_classes.h:617: error: ‘__c_locale’ does not name a type
/usr/include/c++/4.4/bits/locale_classes.h:645: error: expected ‘)’ before ‘__cloc’
/usr/include/c++/4.4/bits/locale_classes.h: In constructor ‘std::collate<_CharT>::collate(size_t)’:
/usr/include/c++/4.4/bits/locale_classes.h:632: error: class ‘std::collate<_CharT>’ does not have any field named ‘_M_c_locale_collate’
/usr/include/c++/4.4/bits/locale_classes.h:632: error: there are no arguments to ‘_S_get_c_locale’ that depend on a template parameter, so a declaration of ‘_S_get_c_locale’ must be available
/usr/include/c++/4.4/bits/locale_classes.h:632: note: (if you use ‘-fpermissive’, G++ will accept your code, but allowing the use of an undeclared name is deprecated)
/usr/include/c++/4.4/bits/locale_classes.h: In destructor ‘virtual std::collate<_CharT>::~collate()’:
/usr/include/c++/4.4/bits/locale_classes.h:709: error: ‘_M_c_locale_collate’ was not declared in this scope
In file included from /usr/include/c++/4.4/bits/locale_facets.h:43,
                 from /usr/include/c++/4.4/bits/basic_ios.h:39,
                 from /usr/include/c++/4.4/ios:45,
                 from /usr/include/c++/4.4/ostream:40,
                 from /usr/include/c++/4.4/iostream:40,
                 from StdAfx.cpp:6:
/usr/include/c++/4.4/i686-linux-gnu/bits/ctype_base.h: At global scope:
/usr/include/c++/4.4/i686-linux-gnu/bits/ctype_base.h:48: error: ‘_ISupper’ was not declared in this scope
/usr/include/c++/4.4/i686-linux-gnu/bits/ctype_base.h:49: error: ‘_ISlower’ was not declared in this scope
/usr/include/c++/4.4/i686-linux-gnu/bits/ctype_base.h:50: error: ‘_ISalpha’ was not declared in this scope
/usr/include/c++/4.4/i686-linux-gnu/bits/ctype_base.h:51: error: ‘_ISdigit’ was not declared in this scope
/usr/include/c++/4.4/i686-linux-gnu/bits/ctype_base.h:52: error: ‘_ISxdigit’ was not declared in this scope
/usr/include/c++/4.4/i686-linux-gnu/bits/ctype_base.h:53: error: ‘_ISspace’ was not declared in this scope
/usr/include/c++/4.4/i686-linux-gnu/bits/ctype_base.h:54: error: ‘_ISprint’ was not declared in this scope
/usr/include/c++/4.4/i686-linux-gnu/bits/ctype_base.h:55: error: ‘_ISalpha’ was not declared in this scope
/usr/include/c++/4.4/i686-linux-gnu/bits/ctype_base.h:55: error: ‘_ISdigit’ was not declared in this scope
/usr/include/c++/4.4/i686-linux-gnu/bits/ctype_base.h:55: error: ‘_ISpunct’ was not declared in this scope
/usr/include/c++/4.4/i686-linux-gnu/bits/ctype_base.h:56: error: ‘_IScntrl’ was not declared in this scope
/usr/include/c++/4.4/i686-linux-gnu/bits/ctype_base.h:57: error: ‘_ISpunct’ was not declared in this scope
/usr/include/c++/4.4/i686-linux-gnu/bits/ctype_base.h:58: error: ‘_ISalpha’ was not declared in this scope
/usr/include/c++/4.4/i686-linux-gnu/bits/ctype_base.h:58: error: ‘_ISdigit’ was not declared in this scope
In file included from /usr/include/c++/4.4/bits/basic_ios.h:39,
                 from /usr/include/c++/4.4/ios:45,
                 from /usr/include/c++/4.4/ostream:40,
                 from /usr/include/c++/4.4/iostream:40,
                 from StdAfx.cpp:6:
/usr/include/c++/4.4/bits/locale_facets.h:67: error: expected ‘,’ or ‘...’ before ‘&’ token
/usr/include/c++/4.4/bits/locale_facets.h:73: error: expected ‘,’ or ‘...’ before ‘&’ token
/usr/include/c++/4.4/bits/locale_facets.h:78: error: expected ‘,’ or ‘...’ before ‘&’ token
/usr/include/c++/4.4/bits/locale_facets.h:83: error: expected ‘,’ or ‘...’ before ‘&’ token
/usr/include/c++/4.4/bits/locale_facets.h:683: error: ‘__c_locale’ does not name a type
/usr/include/c++/4.4/bits/locale_facets.h:724: error: expected ‘)’ before ‘__cloc’
/usr/include/c++/4.4/bits/locale_facets.h:1184: error: ‘__c_locale’ does not name a type
/usr/include/c++/4.4/bits/locale_facets.h:1219: error: expected ‘)’ before ‘__cloc’
In file included from /usr/include/c++/4.4/bits/basic_ios.h:39,
                 from /usr/include/c++/4.4/ios:45,
                 from /usr/include/c++/4.4/ostream:40,
                 from /usr/include/c++/4.4/iostream:40,
                 from StdAfx.cpp:6:
/usr/include/c++/4.4/bits/locale_facets.h:1687: error: expected ‘)’ before ‘__cloc’
/usr/include/c++/4.4/bits/locale_facets.h:1844: error: ‘__c_locale’ has not been declared
/usr/include/c++/4.4/bits/locale_facets.h:1855: error: variable or field ‘_M_initialize_numpunct’ declared void
/usr/include/c++/4.4/bits/locale_facets.h:1855: error: ‘__c_locale’ was not declared in this scope
/usr/include/c++/4.4/bits/locale_facets.h:1863: error: variable or field ‘_M_initialize_numpunct’ declared void
/usr/include/c++/4.4/bits/locale_facets.h:1863: error: ‘__c_locale’ was not declared in this scope
/usr/include/c++/4.4/bits/locale_facets.h: In constructor ‘std::numpunct_byname<_CharT>::numpunct_byname(const char*, size_t)’:
/usr/include/c++/4.4/bits/locale_facets.h:1881: error: ‘__c_locale’ was not declared in this scope
/usr/include/c++/4.4/bits/locale_facets.h:1881: error: expected ‘;’ before ‘__tmp’
/usr/include/c++/4.4/bits/locale_facets.h:1882: error: ‘__tmp’ was not declared in this scope
In file included from /usr/include/c++/4.4/bits/locale_facets.h:2599,
                 from /usr/include/c++/4.4/bits/basic_ios.h:39,
                 from /usr/include/c++/4.4/ios:45,
                 from /usr/include/c++/4.4/ostream:40,
                 from /usr/include/c++/4.4/iostream:40,
                 from StdAfx.cpp:6:
/usr/include/c++/4.4/bits/locale_facets.tcc: In member function ‘virtual _InIter std::num_get<_CharT, _InIter>::do_get(_InIter, _InIter, std::ios_base&, std::_Ios_Iostate&, float&) const’:
/usr/include/c++/4.4/bits/locale_facets.tcc:677: error: there are no arguments to ‘_S_get_c_locale’ that depend on a template parameter, so a declaration of ‘_S_get_c_locale’ must be available
/usr/include/c++/4.4/bits/locale_facets.tcc: In member function ‘virtual _InIter std::num_get<_CharT, _InIter>::do_get(_InIter, _InIter, std::ios_base&, std::_Ios_Iostate&, double&) const’:
/usr/include/c++/4.4/bits/locale_facets.tcc:692: error: there are no arguments to ‘_S_get_c_locale’ that depend on a template parameter, so a declaration of ‘_S_get_c_locale’ must be available
/usr/include/c++/4.4/bits/locale_facets.tcc: In member function ‘virtual _InIter std::num_get<_CharT, _InIter>::do_get(_InIter, _InIter, std::ios_base&, std::_Ios_Iostate&, long double&) const’:
/usr/include/c++/4.4/bits/locale_facets.tcc:724: error: there are no arguments to ‘_S_get_c_locale’ that depend on a template parameter, so a declaration of ‘_S_get_c_locale’ must be available
/usr/include/c++/4.4/bits/locale_facets.tcc: In member function ‘_OutIter std::num_put<_CharT, _OutIter>::_M_insert_float(_OutIter, std::ios_base&, _CharT, char, _ValueT) const’:
/usr/include/c++/4.4/bits/locale_facets.tcc:980: error: there are no arguments to ‘_S_get_c_locale’ that depend on a template parameter, so a declaration of ‘_S_get_c_locale’ must be available
/usr/include/c++/4.4/bits/locale_facets.tcc:988: error: there are no arguments to ‘_S_get_c_locale’ that depend on a template parameter, so a declaration of ‘_S_get_c_locale’ must be available
StdAfx.cpp: In function ‘void DumpTrace(char*)’:
StdAfx.cpp:27: error: ‘TCHAR’ was not declared in this scope
StdAfx.cpp:27: error: expected ‘;’ before ‘szBuffer’
StdAfx.cpp:29: error: ‘szBuffer’ was not declared in this scope
StdAfx.cpp:29: error: ‘_vsntprintf’ was not declared in this scope
StdAfx.cpp:30: error: ‘_CRT_WARN’ was not declared in this scope
StdAfx.cpp:30: error: ‘_CrtDbgReport’ was not declared in this scope
StdAfx.cpp:25: error: ‘va_start’ used in function with fixed args

Hors ligne

#4 Le 08/03/2012, à 12:42

Haleth

Re : error: ‘TCHAR’ was not declared in this scope

T'as regardé mon lien ?
Et la page de man ?
Utilise la balise code


Ubuntu is an ancien African word which means "I can't configure Debian"

Because accessor & mutator are against encapsulation (one of OOP principles), good OOP-programmers do not use them. Obviously, procedural-devs do not. In fact, only ugly-devs are still using them.

Hors ligne

#5 Le 08/03/2012, à 13:32

pingouinux

Re : error: ‘TCHAR’ was not declared in this scope

Salut,

Noureddine-BOUBAKER #3 a écrit :

j'ai tapé  g++ -o StdAfx StdAfx.cpp -I /usr/i586-mingw32msvc/include/

Je mettrais plutôt le paramètre -I au début :

g++ -I /usr/i586-mingw32msvc/include -o StdAfx StdAfx.cpp

Hors ligne

#6 Le 08/03/2012, à 19:05

eiger

Re : error: ‘TCHAR’ was not declared in this scope

Noureddine-BOUBAKER a écrit :

j'ai tapé  g++ -o StdAfx StdAfx.cpp -I /usr/i586-mingw32msvc/include/

Tu appelles le mauvais compilateur : g++ est le compilateur natif.
Si tu utilises Mingw32, c'est que tu veux produire du code pour Win32 (c'est bien cela que tu veux faire, n'est-ce pas ? Créer un exécutable Win32 depuis ton système GNU/Linux ?), auquel cas il te faut appeler le compilateur Mingw32, comme ceci :

i586-mingw32msvc-g++ -o StdAfx StdAfx.cpp

J'ai omis le chemin vers les headers de Mingw32, car je suppose que ce chemin est inclus par défaut, mais si ce n'était pas le cas, tu peux le rajouter.

Pour plus d'infos, regarde la doc : Mingw32

Hors ligne

#7 Le 08/03/2012, à 19:41

Noureddine-BOUBAKER

Re : error: ‘TCHAR’ was not declared in this scope

Merci ,
mé nn je veux migrer une application windows vers linux. smile

Hors ligne

#8 Le 08/03/2012, à 21:56

valAa

Re : error: ‘TCHAR’ was not declared in this scope

Et ben alors faudra remplacer TCHAR par autre chose, ou le définir toi même....
Ce qui ne paraît pas la mer à boire puisque selon msdn http://msdn.microsoft.com/en-us/library/cc842072.aspxc
TCHAR est défini comme suit

typedef char TCHAR;

Dernière modification par valAa (Le 08/03/2012, à 22:00)

Hors ligne