Yeah, it looks like there's some conflict with iostream and msvcrt: http://www.mail-archive.com/wine-devel@winehq.org/msg08834.html
I'm trying to follow the recommendations, but without much luck.
On Mon, Jan 19, 2009 at 11:42 AM, Stefan Dösinger stefan@codeweavers.com wrote:
It looks like you include two headers that define the same type in a differnet way. Ie, a typdef from a Linux header collides with a windows typedef from a Wine header.
-----Original Message----- From: wine-devel-bounces@winehq.org [mailto:wine-devel- bounces@winehq.org] On Behalf Of Rino Farina Sent: Monday, January 19, 2009 3:46 PM To: wine-devel@winehq.org Subject: wineg++ compile error
Hi All,
I'm completely new to wine, and am having trouble compiling code before it ever gets to the linker. Can anyone point me in the right direction?
BaseGameEntity.h:
#include <string>
class BaseGameEntity { private: int m_ID; static int m_iNextValidID;
void SetID(int val);
public: BaseGameEntity(int id) { SetID(id); }
virtual ~BaseGameEntity(){}
virtual void Update()=0; virtual bool HandleMessage(const long& msg)=0;
int ID()const{return m_ID;} };
BaseGameEntity.cpp:
#include "BaseGameEntity.h" #include <cassert>
int BaseGameEntity::m_iNextValidID = 0; void BaseGameEntity::SetID(int val) { assert ( (val >= m_iNextValidID) && "BaseGameEntity::SetID: invalid ID");
m_ID = val;
m_iNextValidID = m_ID + 1; }
Console:
make all wineg++ -c -mno-cygwin -I. -o BaseGameEntity.o BaseGameEntity.cpp In file included from /usr/lib/gcc/i386-redhat- linux/4.3.0/../../../../include/c++/4.3.0/cwchar:52, from /usr/lib/gcc/i386-redhat- linux/4.3.0/../../../../include/c++/4.3.0/bits/postypes.h:47, from /usr/lib/gcc/i386-redhat- linux/4.3.0/../../../../include/c++/4.3.0/bits/char_traits.h:47, from /usr/lib/gcc/i386-redhat- linux/4.3.0/../../../../include/c++/4.3.0/string:47, from BaseGameEntity.h:12, from BaseGameEntity.cpp:1: /usr/include/wchar.h:62: error: conflicting declaration 'typedef unsigned int wint_t' /usr/include/wine/msvcrt/stdio.h:109: error: 'wint_t' has a previous declaration as 'typedef short unsigned int wint_t' In file included from /usr/lib/gcc/i386-redhat- linux/4.3.0/../../../../include/c++/4.3.0/cwchar:52, from /usr/lib/gcc/i386-redhat- linux/4.3.0/../../../../include/c++/4.3.0/bits/postypes.h:47, from /usr/lib/gcc/i386-redhat- linux/4.3.0/../../../../include/c++/4.3.0/bits/char_traits.h:47, from /usr/lib/gcc/i386-redhat- linux/4.3.0/../../../../include/c++/4.3.0/string:47, from BaseGameEntity.h:12, from BaseGameEntity.cpp:1: /usr/include/wchar.h:527: error: expected initializer before '*' token /usr/include/wchar.h:534: error: '__FILE' was not declared in this scope /usr/include/wchar.h:534: error: '__fp' was not declared in this scope /usr/include/wchar.h:534: error: expected primary-expression before 'int' /usr/include/wchar.h:534: error: initializer expression list treated as compound expression /usr/include/wchar.h:534: error: expected ',' or ';' before 'throw' /usr/include/wchar.h:541: error: 'int fwprintf' redeclared as different kind of symbol /usr/include/wine/msvcrt/stdio.h:214: error: previous declaration of 'int fwprintf(FILE*, const wchar_t*, ...)' /usr/include/wchar.h:541: error: '__FILE' was not declared in this scope /usr/include/wchar.h:541: error: expected primary-expression before '__restrict__' /usr/include/wchar.h:542: error: expected primary-expression before 'const' /usr/include/wchar.h:542: error: expected primary-expression before '...' token /usr/include/wchar.h:553: error: declaration of C function 'int swprintf(wchar_t*, size_t, const wchar_t*, ...)' conflicts with /usr/include/wine/msvcrt/stdio.h:223: error: previous declaration 'int swprintf(wchar_t*, const wchar_t*, ...)' here /usr/include/wchar.h:559: error: 'int vfwprintf' redeclared as different kind of symbol /usr/include/wine/msvcrt/stdio.h:226: error: previous declaration of 'int vfwprintf(FILE*, const wchar_t*, char*)' /usr/include/wchar.h:559: error: '__FILE' was not declared in this scope /usr/include/wchar.h:559: error: expected primary-expression before '__restrict__' /usr/include/wchar.h:560: error: expected primary-expression before 'const' /usr/include/wchar.h:561: error: expected primary-expression before '__arg' /usr/include/wchar.h:575: error: declaration of C function 'int vswprintf(wchar_t*, size_t, const wchar_t*, char*)' conflicts with /usr/include/wine/msvcrt/stdio.h:227: error: previous declaration 'int vswprintf(wchar_t*, const wchar_t*, char*)' here /usr/include/wchar.h:582: error: 'int fwscanf' redeclared as different kind of symbol /usr/include/wine/msvcrt/stdio.h:216: error: previous declaration of 'int fwscanf(FILE*, const wchar_t*, ...)' /usr/include/wchar.h:582: error: '__FILE' was not declared in this scope /usr/include/wchar.h:582: error: expected primary-expression before '__restrict__' /usr/include/wchar.h:583: error: expected primary-expression before 'const' /usr/include/wchar.h:583: error: expected primary-expression before '...' token /usr/include/wchar.h:636: error: '__FILE' was not declared in this scope /usr/include/wchar.h:636: error: expected primary-expression before '__restrict__' /usr/include/wchar.h:637: error: expected primary-expression before 'const' /usr/include/wchar.h:638: error: expected primary-expression before '__arg' /usr/include/wchar.h:638: error: initializer expression list treated as compound expression /usr/include/wchar.h:692: error: 'wint_t fgetwc' redeclared as different kind of symbol /usr/include/wine/msvcrt/stdio.h:210: error: previous declaration of 'wint_t fgetwc(FILE*)' /usr/include/wchar.h:692: error: '__FILE' was not declared in this scope /usr/include/wchar.h:692: error: '__stream' was not declared in this scope /usr/include/wchar.h:693: error: 'wint_t getwc' redeclared as different kind of symbol /usr/include/wine/msvcrt/stdio.h:217: error: previous declaration of 'wint_t getwc(FILE*)' /usr/include/wchar.h:693: error: '__FILE' was not declared in this scope /usr/include/wchar.h:693: error: '__stream' was not declared in this scope /usr/include/wchar.h:706: error: '__FILE' has not been declared /usr/include/wchar.h:706: error: declaration of C function 'wint_t fputwc(wchar_t, int*)' conflicts with /usr/include/wine/msvcrt/stdio.h:212: error: previous declaration 'wint_t fputwc(wint_t, FILE*)' here /usr/include/wchar.h:707: error: '__FILE' has not been declared /usr/include/wchar.h:707: error: declaration of C function 'wint_t putwc(wchar_t, int*)' conflicts with /usr/include/wine/msvcrt/stdio.h:220: error: previous declaration 'wint_t putwc(wint_t, FILE*)' here /usr/include/wchar.h:713: error: declaration of C function 'wint_t putwchar(wchar_t)' conflicts with /usr/include/wine/msvcrt/stdio.h:221: error: previous declaration 'wint_t putwchar(wint_t)' here /usr/include/wchar.h:722: error: '__FILE' has not been declared /usr/include/wchar.h:722: error: declaration of C function 'wchar_t* fgetws(wchar_t*, int, int*)' conflicts with /usr/include/wine/msvcrt/stdio.h:211: error: previous declaration 'wchar_t* fgetws(wchar_t*, int, FILE*)' here /usr/include/wchar.h:729: error: '__FILE' has not been declared /usr/include/wchar.h:729: error: declaration of C function 'int fputws(const wchar_t*, int*)' conflicts with /usr/include/wine/msvcrt/stdio.h:215: error: previous declaration 'int fputws(const wchar_t*, FILE*)' here /usr/include/wchar.h:736: error: '__FILE' has not been declared /usr/include/wchar.h:736: error: declaration of C function 'wint_t ungetwc(wint_t, int*)' conflicts with /usr/include/wine/msvcrt/stdio.h:225: error: previous declaration 'wint_t ungetwc(wint_t, FILE*)' here /usr/include/wchar.h:748: error: '__FILE' was not declared in this scope /usr/include/wchar.h:748: error: '__stream' was not declared in this scope /usr/include/wchar.h:757: error: '__FILE' was not declared in this scope /usr/include/wchar.h:757: error: '__stream' was not declared in this scope /usr/include/wchar.h:765: error: '__FILE' has not been declared /usr/include/wchar.h:774: error: '__FILE' has not been declared /usr/include/wchar.h:785: error: '__FILE' has not been declared /usr/include/wchar.h:794: error: '__FILE' has not been declared In file included from /usr/lib/gcc/i386-redhat- linux/4.3.0/../../../../include/c++/4.3.0/cstdio:50, from /usr/lib/gcc/i386-redhat- linux/4.3.0/../../../../include/c++/4.3.0/bits/char_traits.h:48, from /usr/lib/gcc/i386-redhat- linux/4.3.0/../../../../include/c++/4.3.0/string:47, from BaseGameEntity.h:12, from BaseGameEntity.cpp:1: /usr/include/stdio.h:49: error: conflicting declaration 'typedef struct _IO_FILE FILE' /usr/include/wine/msvcrt/stdio.h:84: error: 'FILE' has a previous declaration as 'typedef struct _iobuf FILE' In file included from /usr/lib/gcc/i386-redhat- linux/4.3.0/../../../../include/c++/4.3.0/bits/char_traits.h:48, from /usr/lib/gcc/i386-redhat- linux/4.3.0/../../../../include/c++/4.3.0/string:47, from BaseGameEntity.h:12, from BaseGameEntity.cpp:1: /usr/lib/gcc/i386-redhat- linux/4.3.0/../../../../include/c++/4.3.0/cstdio:170: error: '::snprintf' has not been declared /usr/lib/gcc/i386-redhat- linux/4.3.0/../../../../include/c++/4.3.0/cstdio:171: error: '::vfscanf' has not been declared /usr/lib/gcc/i386-redhat- linux/4.3.0/../../../../include/c++/4.3.0/cstdio:172: error: '::vscanf' has not been declared /usr/lib/gcc/i386-redhat- linux/4.3.0/../../../../include/c++/4.3.0/cstdio:174: error: '::vsscanf' has not been declared /usr/lib/gcc/i386-redhat- linux/4.3.0/../../../../include/c++/4.3.0/cstdio:181: error: '__gnu_cxx::snprintf' has not been declared /usr/lib/gcc/i386-redhat- linux/4.3.0/../../../../include/c++/4.3.0/cstdio:182: error: '__gnu_cxx::vfscanf' has not been declared /usr/lib/gcc/i386-redhat- linux/4.3.0/../../../../include/c++/4.3.0/cstdio:183: error: '__gnu_cxx::vscanf' has not been declared /usr/lib/gcc/i386-redhat- linux/4.3.0/../../../../include/c++/4.3.0/cstdio:185: error: '__gnu_cxx::vsscanf' has not been declared In file included from /usr/include/_G_config.h:20, from /usr/include/libio.h:32, from /usr/include/stdio.h:75, from /usr/lib/gcc/i386-redhat- linux/4.3.0/../../../../include/c++/4.3.0/cstdio:50, from /usr/lib/gcc/i386-redhat- linux/4.3.0/../../../../include/c++/4.3.0/bits/ios_base.h:49, from /usr/lib/gcc/i386-redhat- linux/4.3.0/../../../../include/c++/4.3.0/ios:48, from /usr/lib/gcc/i386-redhat- linux/4.3.0/../../../../include/c++/4.3.0/ostream:45, from /usr/lib/gcc/i386-redhat- linux/4.3.0/../../../../include/c++/4.3.0/iostream:45, from /home/rino/Download/Buckland_AISource_070308/EclipseProjects/Common/Mes saging/Telegram.h:14, from BaseGameEntity.h:14, from BaseGameEntity.cpp:1: /usr/include/wine/msvcrt/wchar.h:62: error: conflicting declaration 'typedef int mbstate_t' /usr/include/wchar.h:101: error: 'mbstate_t' has a previous declaration as 'typedef struct __mbstate_t mbstate_t' /usr/include/wine/msvcrt/wchar.h:412: error: declaration of C function 'wchar_t* wcstok(wchar_t*, const wchar_t*)' conflicts with /usr/include/wchar.h:246: error: previous declaration 'wchar_t* wcstok(wchar_t*, const wchar_t*, wchar_t**)' here /usr/include/wine/msvcrt/wchar.h:425: error: declaration of C function 'wchar_t btowc(int)' conflicts with /usr/include/wchar.h:300: error: previous declaration 'wint_t btowc(int)' here In file included from /usr/lib/gcc/i386-redhat- linux/4.3.0/../../../../include/c++/4.3.0/cstdio:50, from /usr/lib/gcc/i386-redhat- linux/4.3.0/../../../../include/c++/4.3.0/bits/ios_base.h:49, from /usr/lib/gcc/i386-redhat- linux/4.3.0/../../../../include/c++/4.3.0/ios:48, from /usr/lib/gcc/i386-redhat- linux/4.3.0/../../../../include/c++/4.3.0/ostream:45, from /usr/lib/gcc/i386-redhat- linux/4.3.0/../../../../include/c++/4.3.0/iostream:45, from /home/rino/Download/Buckland_AISource_070308/EclipseProjects/Common/Mes saging/Telegram.h:14, from BaseGameEntity.h:14, from BaseGameEntity.cpp:1: /usr/include/stdio.h:91: error: conflicting declaration 'typedef struct _G_fpos_t fpos_t' /usr/include/wine/msvcrt/stdio.h:88: error: 'fpos_t' has a previous declaration as 'typedef long long int fpos_t' In file included from /usr/lib/gcc/i386-redhat- linux/4.3.0/../../../../include/c++/4.3.0/cstdio:50, from /usr/lib/gcc/i386-redhat- linux/4.3.0/../../../../include/c++/4.3.0/bits/ios_base.h:49, from /usr/lib/gcc/i386-redhat- linux/4.3.0/../../../../include/c++/4.3.0/ios:48, from /usr/lib/gcc/i386-redhat- linux/4.3.0/../../../../include/c++/4.3.0/ostream:45, from /usr/lib/gcc/i386-redhat- linux/4.3.0/../../../../include/c++/4.3.0/iostream:45, from /home/rino/Download/Buckland_AISource_070308/EclipseProjects/Common/Mes saging/Telegram.h:14, from BaseGameEntity.h:14, from BaseGameEntity.cpp:1: /usr/include/stdio.h:145: error: expected `)' before '+' token /usr/include/stdio.h:145: error: expected initializer before '+' token /usr/include/stdio.h:146: error: expected `)' before '+' token /usr/include/stdio.h:146: error: expected initializer before '+' token /usr/include/stdio.h:147: error: expected `)' before '+' token /usr/include/stdio.h:147: error: expected initializer before '+' token /usr/include/wine/msvcrt/stdio.h:246: error: previous declaration of 'char* tempnam(const char*, const char*)' with 'C++' linkage /usr/include/stdio.h:207: error: conflicts with new declaration with 'C' linkage /usr/include/wine/msvcrt/stdio.h:240: error: previous declaration of 'FILE* fdopen(int, const char*)' with 'C++' linkage /usr/include/stdio.h:285: error: conflicts with new declaration with 'C' linkage /usr/include/wine/msvcrt/stdio.h:251: error: previous declaration of 'int vsnprintf(char*, size_t, const char*, char*)' with 'C++' linkage /usr/include/stdio.h:369: error: conflicts with new declaration with 'C' linkage /usr/include/wine/msvcrt/stdio.h:255: error: previous declaration of 'int getw(FILE*)' with 'C++' linkage /usr/include/stdio.h:590: error: conflicts with new declaration with 'C' linkage /usr/include/wine/msvcrt/stdio.h:256: error: previous declaration of 'int putw(int, FILE*)' with 'C++' linkage /usr/include/stdio.h:593: error: conflicts with new declaration with 'C' linkage /usr/include/stdio.h:774: error: declaration of C function 'int fsetpos(FILE*, const fpos_t*)' conflicts with /usr/include/wine/msvcrt/stdio.h:166: error: previous declaration 'int fsetpos(FILE*, fpos_t*)' here In file included from /usr/lib/gcc/i386-redhat- linux/4.3.0/../../../../include/c++/4.3.0/cstdio:50, from /usr/lib/gcc/i386-redhat- linux/4.3.0/../../../../include/c++/4.3.0/bits/ios_base.h:49, from /usr/lib/gcc/i386-redhat- linux/4.3.0/../../../../include/c++/4.3.0/ios:48, from /usr/lib/gcc/i386-redhat- linux/4.3.0/../../../../include/c++/4.3.0/ostream:45, from /usr/lib/gcc/i386-redhat- linux/4.3.0/../../../../include/c++/4.3.0/iostream:45, from /home/rino/Download/Buckland_AISource_070308/EclipseProjects/Common/Mes saging/Telegram.h:14, from BaseGameEntity.h:14, from BaseGameEntity.cpp:1: /usr/include/wine/msvcrt/stdio.h:242: error: previous declaration of 'int fileno(FILE*)' with 'C++' linkage /usr/include/stdio.h:829: error: conflicts with new declaration with 'C' linkage /usr/include/wine/msvcrt/stdio.h:245: error: previous declaration of 'FILE* popen(const char*, const char*)' with 'C++' linkage /usr/include/stdio.h:844: error: conflicts with new declaration with 'C' linkage /usr/include/wine/msvcrt/stdio.h:244: error: previous declaration of 'int pclose(FILE*)' with 'C++' linkage /usr/include/stdio.h:850: error: conflicts with new declaration with 'C' linkage In file included from /usr/lib/gcc/i386-redhat- linux/4.3.0/../../../../include/c++/4.3.0/cwctype:51, from /usr/lib/gcc/i386-redhat- linux/4.3.0/../../../../include/c++/4.3.0/bits/locale_facets.h:46, from /usr/lib/gcc/i386-redhat- linux/4.3.0/../../../../include/c++/4.3.0/bits/basic_ios.h:44, from /usr/lib/gcc/i386-redhat- linux/4.3.0/../../../../include/c++/4.3.0/ios:50, from /usr/lib/gcc/i386-redhat- linux/4.3.0/../../../../include/c++/4.3.0/ostream:45, from /usr/lib/gcc/i386-redhat- linux/4.3.0/../../../../include/c++/4.3.0/iostream:45, from /home/rino/Download/Buckland_AISource_070308/EclipseProjects/Common/Mes saging/Telegram.h:14, from BaseGameEntity.h:14, from BaseGameEntity.cpp:1: /usr/include/wctype.h:53: error: conflicting declaration 'typedef long unsigned int wctype_t' /usr/include/wine/msvcrt/stdio.h:110: error: 'wctype_t' has a previous declaration as 'typedef short unsigned int wctype_t' /usr/include/wctype.h:195: error: declaration of C function 'wint_t towlower(wint_t)' conflicts with /usr/include/wine/msvcrt/wchar.h:255: error: previous declaration 'wchar_t towlower(wchar_t)' here /usr/include/wctype.h:198: error: declaration of C function 'wint_t towupper(wint_t)' conflicts with /usr/include/wine/msvcrt/wchar.h:256: error: previous declaration 'wchar_t towupper(wchar_t)' here winegcc: g++ failed make: *** [BaseGameEntity.o] Error 2