Re: Debug build compile error in 'gobject/gobject.c'
- Date: Wed, 3 Aug 2016 18:46:32 +0100
- From: Emmanuele Bassi <ebassi@xxxxxxxxx>
- Subject: Re: Debug build compile error in 'gobject/gobject.c'
On 3 August 2016 at 18:36, John Emmas <johne53@xxxxxxxxxxxxx> wrote:
> Hi there - I just came across a problem after updating libglib to the latest
> git master (my last update was about a fortnight ago).
> I'm building with MSVC 8 and when I try to compile 'gobject/gobject.c' the
> Release version compiles fine but compiling in Debug mode gives me an error
> around these lines at the end of function 'void g_object_type_init (void)
> (approximately line 400):-
> GOBJECT_IF_DEBUG (OBJECTS,
> debug_objects_ht = g_hash_table_new (g_direct_hash, NULL);
> #ifndef G_HAS_CONSTRUCTORS
> g_atexit (debug_objects_atexit);
> #endif /* G_HAS_CONSTRUCTORS */
> The error I see is:-
> gobject\gobject.c(403) : error C2121: '#' : invalid character :
> possibly the result of a macro expansion
> AFAICT gobject.c itself hasn't changed recently so is it possible that
> GOBJECT_IF_DEBUG has changed somehow? The Release build compiles okay so I
> guess that seems plausible. Thanks,
This is likely a MSVC 8 issue. The GOBJECT_IF_DEBUG macro expands the
second argument to a code block, and it seems MSVC 8 has issues when
that includes a conditional pre-processor directive.
GOBJECT_IF_DEBUG hasn't changed since 2014, and the same commit
introduced the use you see failing.
[@] ebassi [@gmail.com]
gtk-devel-list mailing list