This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Newbie Link problem. (win 98)


Gary Powell <Gary.Powell@sierra.com> writes:
>   First, I am evaluating the cygnus tools and specifically gcc 2.95 for use
> at my company Sierra.
> 
>   I have a fairly simple bit of code which I am trying to link. I have read
> all the documentation on the Cygnus site that I could find relating to this
> and either I am really dumb, lacking in caffeine or its not obvious.
> 
> Sample code:
> 
> #include <iostream>
> int main(int, char **)
> {
>   std::cout << "Hello world" << std::endl;
> 
>   return 1;
> }
> 
> if I use
> 
> g++ -o hello.exe -mpentium hello.cpp
> 
> I get link errors, about missing ostream stuff.

This should definitely work, and it's a bug otherwise. Please send me the 
"bug.txt" file: 
  
   $ echo env > bug.txt
   $ env >> bug.txt
   $ gcc -v >> bug.txt 2>&1
   $ g++ -v -o hello.exe -mpentium hello.cpp -v >> bug.txt 2>&1

Your installation is suspect.

> So I've added the specific libraries, -lstdc++ -lc

FYI, due to a weird quirk in Cygwin packaging, adding -lc is not a good 
idea.  Hopefully that will be fixed in the future. G++ or C++ drivers
will automatically add -lstdc++, so you shouldn't have to. Use the -v
option to see what's going on.

> 
> and now I'm missing only sysconf and sbrk. I tried adding 
> -lmmalloc to the end of the library list
> and it only created more missing calls. getpagesize, and _kill

mmalloc is unnecessary for sbrk and sysconf. Both of these are in
the default Cygwin runtime, libcygwin.a, which is automatically
linked in by gcc/g++/c++/g77/etc.

> I've also tried adding the mingw code and adding mingw32, then
> shell32, then kernel32 (Even though I found documentation telling me
> specifically not to include this one, I was getting desperate) and msvcrt

Now, I'm confused. Are you using Cygwin runtime or Mingw runtime? If
you're using Mingw runtime and just *using* Cygwin tools, then you're
going about it the wrong way. See my -mno-cygwin howto at:
  http://www.xraylith.wisc.edu/~khan/software/gnu-win32/

If you're using Cygwin runtime, then you can't just "add" mingw code, and
nor can you add msvcrt.

>   Can you please either point me to the proper place to ask this question,
> or tell me what library I'm missing. Or that its impossible, so I'll quit
> banging my head on the keyboard.

You've come to the right place. However, to get help, you need to provide
more information, such as what I had asked for earlier, and possibly
example code. 

First of all, you need to tell us exactly what you're trying to do with
Cygwin. Are you evaluating the whole Cygwin environment -- tools and the
runtime, or just the tools using Mingw/MS runtime?

Regards,
Mumit


--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]