cygwin g++ strictness

John Emmas
Fri Oct 31 11:04:00 GMT 2008

----- Original Message ----- 
From: "John Emmas"
Sent: 31 October 2008 08:21
Subject: Re: cygwin g++ strictness
> adding the compiler flag -fpermissive seems to have solved the problem.

----- Original Message ----- 
From: "Václav Haisman"
Sent: 31 October 2008 10:07
Subject: Re: cygwin g++ strictness
> It just works. You are doing something wrong. There is nothing wrong
> with GCC 3.4 in this respect.

It seems like I spoke to soon.....  -fpermissive seems to have helped in
some cases but not in every case.  I'll give an example. Please can someone
tell me if I'm misunderstanding something here.  Consider the following
function prototype (where 'gint' is typedef'd as an int in gtypes.h):-

#include <gtypes.h>
int AddTwoInts (gint& a, gint& b);

This code compiles under both Linux/gcc4.4 and also under Cygwin:-
gint x = 4;
gint y = 5;
int z = AddTwoInts (x, y);

This code compiles under Linux/gcc4.4 but not under Cygwin:-
#include <sys/types.h>   // typedefs int32_t as int
int32_t x = 4;
int32_t y = 5;
int z = AddTwoInts (x, y);

The last example produces this error on my system:-
error: no matching function for call to `AddTwoInts(int32_t&, int32_t&)'
note: candidates are: int AddTwoInts(gint&, gint&)
:: === Build finished: 2 errors, 0 warnings ===

Here's the compiler's command line:-
gcc.exe -Wall -DXTHREADS -DXUSE_MTSAFE_API -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include
 -I/usr/X11R6/include -I/usr/include/atk-1.0 -I/usr/include/pango-1.0 -I/usr/include/freetype2
 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -mwindows -g -IC:/cygwin/include
 -IC:/cygwin/usr/include/gtk-2.0 -IC:/cygwin/usr/include/glib-2.0 -IC:/cygwin/usr/include/pango-1.0
 -IC:/cygwin/lib/glib-2.0/include -IC:/cygwin/lib/gtk-2.0/include -IC:/cygwin/usr/include/atk-1.0
 -IC:/cygwin/usr/include/cairo -IC:/cygwin/usr/include/libgnomecanvas-2.0 -IF:/GTK/HelloWorld
 -c F:/GTK/HelloWorld/Test.c -o obj/Debug/Test.o

This is an example where adding -fpermissive doesn't help (in fact, I don't
even think it's relevant for plain old 'C').  So can anyone see what I'm
doing wrong?



Unsubscribe info:
Problem reports:

More information about the Cygwin mailing list