Page 1 of 1

Trouble compiling wxWindows plugin in Visual C++ 7.1

Posted: 16 Jan 2004 15:55
by Vlad
I try to build the wxWindows plugin in VC 7.1. I was successful in building wxWindows 2.4.2 library and all its samples and demos. However, when I try to build the VLC wxWindow plugin, I got such error:

"error C2628: '_off_t' followed by '__int64' is illegal (did you forget a ';'?)"

it points to the typedef line in wxWindow file filefn.h

#if defined(__VISUALC__) || ( defined(__MWERKS__) && defined( __INTEL__) )
typedef _off_t off_t;

This file didn't give me any trouble when I compiled wxWindow library and samples. Therefore, the trouble is related somehow to the VLC usage of the headers and defines. The VLC developer documentation (BTW, seems not updated since 2001) tells something about off_t data type and necessity to compile with -D_FILE_OFFSET_BITS=64 -D__USE_UNIX98.
In VC++, the off_t is already defined as 64 bit, so the compiler option doesn't seem to be needed.
I am puzzled why compiling the library itself didn't give me any trouble.

Please help to resolve the situation.

Posted: 16 Jan 2004 19:04
by The DJ
Why use VC++?

Posted: 16 Jan 2004 19:49
by Guest
VC++ has very convenient debugger. I want to add one more input plugin, but, unfortunately, I can't use release version of wxWindows plugin with other modules built in debug mode - it keeps generating exceptions.

I found the source of the conflict: wxWindow file filefn.h has typedef for off_t:

#if defined(__VISUALC__) || ( defined(__MWERKS__) && defined( __INTEL__) )
typedef _off_t off_t;

but earlier in vlc_common the same off_t already defined:

# if defined( _MSC_VER )
# if !defined( _OFF_T_DEFINED )
typedef __int64 off_t;
# define _OFF_T_DEFINED
# else
# define off_t __int64
# endif
# endif

so "typedef _off_t off_t" conflicts with earlier "define off_t __int64"

I think this is a bug. I found how to fix it by modifying code in filefn.h, but this is not the right way to do it - the wxWindow library shouldn't be modified for use in VLC.

I would appreciate any help in specifying what to modify in VLC code to make wxWindows buildable in Visual C++.

Posted: 16 Jan 2004 20:57
by Sigmund
Try including the wxwindows headers before the vlc headers in the files in question

Posted: 17 Jan 2004 12:08
by Gibalou
Btw Vlad, if you manage to get this compiled under VC, we would gladly accept patches.

building and running wxWindows plugin in VC++ 7.1

Posted: 19 Jan 2004 16:38
by Vlad
Btw Vlad, if you manage to get this compiled under VC, we would gladly accept patches.
I finally managed to build and run in debug mode the wxWindows plugin in Visual C++ 7.1 (.NET 2003). I had to make the following changes:

1) in wxWindows header file filefn.h (unfortunately):

added on line 34 the condition !defined( _OFF_T_DEFINED ), so the changed lines look like:

#if (!defined( _OFF_T_DEFINED ) && defined(__VISUALC__)) || ( defined(__MWERKS__) && defined( __INTEL__) )
typedef _off_t off_t;

2) two changes in wxWindows.cpp plugin file:

a) added #include <locale.h>
b) modified one line inside "static void Init( intf_thread_t *p_intf )" function (commented out hInstance and put GetModuleHandle call):
#if !defined(__BUILTIN__)
wxEntry( /*hInstance*/GetModuleHandle(NULL), NULL, NULL, SW_SHOW );

the hInstance was always NULL - at least when I ran it in Win XP, so I put there the explicit call to GetModuleHandle.