public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Re: 1.5.7  undefined reference to getreent when using mno-cygwin
       [not found] <4828218F.30206@iai.csic.es>
@ 2008-05-12 15:52 ` Igor Peshansky
  0 siblings, 0 replies; 3+ messages in thread
From: Igor Peshansky @ 2008-05-12 15:52 UTC (permalink / raw)
  To: Jesús Oliva; +Cc: cygwin

[-- Attachment #1: Type: TEXT/PLAIN, Size: 4099 bytes --]

<http://cygwin.com/acronyms/#PPIOSPE>.  I've redirected your query to the
appropriate list and set the Reply-To: header -- please make sure your
mailer honors it.

Ugh, top-posting...  Reformatted.

On Mon, 12 May 2008, Jesús Oliva wrote:

> > > Hi,
> > >
> > > I have a pure Win32 console program which I am trying to compile under
> > > Cygwin. I am
> > > including the following libraries
> > >
> > >         -lws2_32 -lrpcrt4 -luuid -lrpcns4 -lpsapi -liphlpapi
> > >
> > > and am using a host of Win32 calls for threading, sockets, semaphores, etc.
> > >
> > > I know that I need to compile with the option -mno-cygwin to be able to run
> > > the program on
> > > a computer without the cygwin.dll, which is what I want, however, when I add
> > > this option I
> > > get the following linker error:
> > >
> > >         undefined reference to `___getreent'
> > >
> > > This is my linker statement:
> > >
> > > g++ -g -O2 -D_GNU_SOURCE -D_REENTRANT -D_THREAD_SAFE -D WIN32 -D CYGWIN -D
> > > __CYGWIN__
> > > CoreMain.o CoreLibrary.a -Wl,--rpath -Wl,/usr/local/lib  -o CoreTest
> > > -mno-cygwin -lws2_32
> > > -lrpcrt4 -luuid -lrpcns4 -lpsapi -liphlpapi
> > >
> > > I have found that I get this for every line in the code where I use either
> > >
> > >         getchar()
> > > or
> > >         printf("...\b..."); fflush(stdout);
> > >
> > > and when I comment out these the error goes away, but jumps to the next line
> > > or file where
> > > I use this or something like it. I must admit that I have not tried removing
> > > all hundreds
> > > of them, just the first 15 or so...
> > >
> > > I have tried to include all sorts of libraries instead of the cygwin.dll and
> > > actually,
> > > when I include the -lpthread it compiles, but then the program crashes when
> > > I start using
> > > threads and semaphores...
> > >
> > > As I mentioned above, when I do not state -mno-cygwin, everything works fine
> > > and the
> > > program runs perfectly! But then it needs the cygwin.dll, of course...
> > >
> > > I found a few references to this on the web, mostly promoting the compiler
> > > directive
> > >
> > >         -D __CYGWIN__
> > >
> > > which I have tried, but to no avail...
> > >
> > > Below is a snippet of output from the linker. I hope this will make sense to
> > > somebody out
> > > there, who can tell me what to include in my linker statement...
> > >
> > > Thank you very much in advance!
> > >
> > > Best regards,
> > > Thor List
> > >
> > > [Linker output snipped]
> >
> > Thor,
> >
> > You have to use -mno-cygwin for the whole compilation, not just for the
> > link line, otherwise the wrong headers get picked up.  IOW, don't add
> > "-mno-cygwin" to LDFLAGS -- instead, redefine CXX='g++ -mno-cygwin' (and
> > CC='gcc -mno-cygwin') and rebuild everything from scratch.
> >        Igor
>
> I have a similar problem that the one related below, but when I try to
                                                above
> compile everything with the -mno-cygwin option, I get many errors such
> as:
>
> 'error: u_int32_t has not been declared
>
> I suppose that, if I don´t want to use cygwin.dll, I should add some
> libraries to the compiling and linking process, but I don´t know wich.
> Could you help me??
>
> Thank you very much,
> Jesús Oliva

You may need headers that define the above types, or you may be unable to
compile the code with -mno-cygwin if those headers are not present in
MinGW.

Remember, -mno-cygwin means "no Cygwin" -- you're using MinGW, and will
only be able to compile programs that MinGW has enough support for.

Further questions about this should really be directed to a MinGW list...
	Igor
-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_	    pechtcha@cs.nyu.edu | igor@watson.ibm.com
ZZZzz /,`.-'`'    -.  ;-;;,_		Igor Peshansky, Ph.D. (name changed!)
     |,4-  ) )-,_. ,\ (  `'-'		old name: Igor Pechtchanski
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

"That which is hateful to you, do not do to your neighbor.  That is the whole
Torah; the rest is commentary.  Go and study it." -- Rabbi Hillel

[-- Attachment #2: Type: text/plain, Size: 218 bytes --]

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: 1.5.7  undefined reference to getreent when using mno-cygwin
  2004-03-05 13:33 list
@ 2004-03-05 16:37 ` Igor Pechtchanski
  0 siblings, 0 replies; 3+ messages in thread
From: Igor Pechtchanski @ 2004-03-05 16:37 UTC (permalink / raw)
  To: list; +Cc: cygwin

On Fri, 5 Mar 2004 list<at>list<dot>dk wrote:

> Hi,
>
> I have a pure Win32 console program which I am trying to compile under Cygwin. I am
> including the following libraries
>
>         -lws2_32 -lrpcrt4 -luuid -lrpcns4 -lpsapi -liphlpapi
>
> and am using a host of Win32 calls for threading, sockets, semaphores, etc.
>
> I know that I need to compile with the option -mno-cygwin to be able to run the program on
> a computer without the cygwin.dll, which is what I want, however, when I add this option I
> get the following linker error:
>
>         undefined reference to `___getreent'
>
> This is my linker statement:
>
> g++ -g -O2 -D_GNU_SOURCE -D_REENTRANT -D_THREAD_SAFE -D WIN32 -D CYGWIN -D __CYGWIN__
> CoreMain.o CoreLibrary.a -Wl,--rpath -Wl,/usr/local/lib  -o CoreTest -mno-cygwin -lws2_32
> -lrpcrt4 -luuid -lrpcns4 -lpsapi -liphlpapi
>
> I have found that I get this for every line in the code where I use either
>
>         getchar()
> or
>         printf("...\b..."); fflush(stdout);
>
> and when I comment out these the error goes away, but jumps to the next line or file where
> I use this or something like it. I must admit that I have not tried removing all hundreds
> of them, just the first 15 or so...
>
> I have tried to include all sorts of libraries instead of the cygwin.dll and actually,
> when I include the -lpthread it compiles, but then the program crashes when I start using
> threads and semaphores...
>
> As I mentioned above, when I do not state -mno-cygwin, everything works fine and the
> program runs perfectly! But then it needs the cygwin.dll, of course...
>
> I found a few references to this on the web, mostly promoting the compiler directive
>
>         -D __CYGWIN__
>
> which I have tried, but to no avail...
>
> Below is a snippet of output from the linker. I hope this will make sense to somebody out
> there, who can tell me what to include in my linker statement...
>
> Thank you very much in advance!
>
> Best regards,
> Thor List
>
> [Linker output snipped]

Thor,

You have to use -mno-cygwin for the whole compilation, not just for the
link line, otherwise the wrong headers get picked up.  IOW, don't add
"-mno-cygwin" to LDFLAGS -- instead, redefine CXX='g++ -mno-cygwin' (and
CC='gcc -mno-cygwin') and rebuild everything from scratch.
	Igor
-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_		pechtcha@cs.nyu.edu
ZZZzz /,`.-'`'    -.  ;-;;,_		igor@watson.ibm.com
     |,4-  ) )-,_. ,\ (  `'-'		Igor Pechtchanski, Ph.D.
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

"I have since come to realize that being between your mentor and his route
to the bathroom is a major career booster."  -- Patrick Naughton

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* 1.5.7  undefined reference to getreent when using mno-cygwin
@ 2004-03-05 13:33 list
  2004-03-05 16:37 ` Igor Pechtchanski
  0 siblings, 1 reply; 3+ messages in thread
From: list @ 2004-03-05 13:33 UTC (permalink / raw)
  To: cygwin

Hi,

I have a pure Win32 console program which I am trying to compile under Cygwin. I am
including the following libraries

	-lws2_32 -lrpcrt4 -luuid -lrpcns4 -lpsapi -liphlpapi

and am using a host of Win32 calls for threading, sockets, semaphores, etc.

I know that I need to compile with the option -mno-cygwin to be able to run the program on
a computer without the cygwin.dll, which is what I want, however, when I add this option I
get the following linker error:

	undefined reference to `___getreent'

This is my linker statement:

g++ -g -O2 -D_GNU_SOURCE -D_REENTRANT -D_THREAD_SAFE -D WIN32 -D CYGWIN -D __CYGWIN__
CoreMain.o CoreLibrary.a -Wl,--rpath -Wl,/usr/local/lib  -o CoreTest -mno-cygwin -lws2_32
-lrpcrt4 -luuid -lrpcns4 -lpsapi -liphlpapi

I have found that I get this for every line in the code where I use either

	getchar()
or
	printf("...\b..."); fflush(stdout);

and when I comment out these the error goes away, but jumps to the next line or file where
I use this or something like it. I must admit that I have not tried removing all hundreds
of them, just the first 15 or so...

I have tried to include all sorts of libraries instead of the cygwin.dll and actually,
when I include the -lpthread it compiles, but then the program crashes when I start using
threads and semaphores...

As I mentioned above, when I do not state -mno-cygwin, everything works fine and the
program runs perfectly! But then it needs the cygwin.dll, of course...

I found a few references to this on the web, mostly promoting the compiler directive

	-D __CYGWIN__

which I have tried, but to no avail...

Below is a snippet of output from the linker. I hope this will make sense to somebody out
there, who can tell me what to include in my linker statement...

Thank you very much in advance!


Best regards,

Thor List


Linker output (with a few comments):

g++ -g -O2 -D_GNU_SOURCE -D_REENTRANT -D_THREAD_SAFE -D WIN32 -D CYGWIN -D __CYGWIN__
CoreMain.o CoreLibrary.a -Wl,--rpath -Wl,/usr/local/lib  -o CoreTest -mno-cygwin -lws2_32
-lrpcrt4 -luuid -lrpcns4 -lpsapi -liphlpapi

CoreMain.o(.text+0x1d4): In function `main':
/cygdrive/d/cm/psyclone/CoreLibrary/CoreMain.cpp:259: undefined reference to `___getreent'

	// line 259: 	getchar();

CoreLibrary.a(Network.o)(.text+0x5c97): In function `_ZN7Network8unitTestEv':
/cygdrive/d/cm/psyclone/CoreLibrary/Network.cpp:653: undefined reference to `___getreent'
CoreLibrary.a(Network.o)(.text+0x61a7):/cygdrive/d/cm/psyclone/CoreLibrary/Network.cpp:680
: undefined reference to `___getreent'

	// line 680:	printf(".\b"); fflush(stdout);

CoreLibrary.a(Network.o)(.text+0x62a0):/cygdrive/d/cm/psyclone/CoreLibrary/Network.cpp:682
: undefined reference to `___getreent'

	// line 682:	printf("o\b"); fflush(stdout);

CoreLibrary.a(Network.o)(.text+0x62e4):/cygdrive/d/cm/psyclone/CoreLibrary/Network.cpp:684
: undefined reference to `___getreent'

	// line 684:	printf("O\b"); fflush(stdout);

CoreLibrary.a(Network.o)(.text+0x63fe):/cygdrive/d/cm/psyclone/CoreLibrary/Network.cpp:703
: more undefined references to `___getreent' follow

	// line 703:	printf(" \b"); fflush(stdout);

collect2: ld returned 1 exit status
make.exe: *** [CoreTest] Error 1





--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-05-12 15:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <4828218F.30206@iai.csic.es>
2008-05-12 15:52 ` 1.5.7 undefined reference to getreent when using mno-cygwin Igor Peshansky
2004-03-05 13:33 list
2004-03-05 16:37 ` Igor Pechtchanski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).