Thread: How do I use Cygwin?

  1. #1
    Ethernal Noob
    Join Date
    Nov 2001
    Posts
    1,901

    How do I use Cygwin?

    I was trying different compilers just to get used to them. I was looking on Bjarne Stroustrup's page and he recommended cygwin. I installed that one, but after I opened the bat file i really don't know what to do. It doesn't really come with understandable (in my case) instructions or anything. Can someone at least get me to set it up and compile something?

  2. #2
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    Type gcc or g++ on the prompt and see what happens.

    Moving thread to the tech forum....

    Eg
    Code:
     $ g++ --help
     Usage: g++ [options] file...
     Options:
       -pass-exit-codes         Exit with highest error code from a phase
       --help                   Display this information
       --target-help            Display target specific command line options
       (Use '-v --help' to display command line options of sub-processes)
       -dumpspecs               Display all of the built in spec strings
       -dumpversion             Display the version of the compiler
       -dumpmachine             Display the compiler's target processor
       -print-search-dirs       Display the directories in the compiler's search path
     
       -print-libgcc-file-name  Display the name of the compiler's companion library
       -print-file-name=<lib>   Display the full path to library <lib>
       -print-prog-name=<prog>  Display the full path to compiler component <prog>
       -print-multi-directory   Display the root directory for versions of libgcc
       -print-multi-lib         Display the mapping between command line options and
                                multiple library search directories
       -print-multi-os-directory Display the relative path to OS libraries
       -Wa,<options>            Pass comma-separated <options> on to the assembler
       -Wp,<options>            Pass comma-separated <options> on to the preprocessor
     
       -Wl,<options>            Pass comma-separated <options> on to the linker
       -Xlinker <arg>           Pass <arg> on to the linker
       -save-temps              Do not delete intermediate files
       -pipe                    Use pipes rather than intermediate files
       -time                    Time the execution of each subprocess
       -specs=<file>            Override built-in specs with the contents of <file>
       -std=<standard>          Assume that the input sources are for <standard>
       -B <directory>           Add <directory> to the compiler's search paths
       -b <machine>             Run gcc for target <machine>, if installed
       -V <version>             Run gcc version number <version>, if installed
       -v                       Display the programs invoked by the compiler
       -###                     Like -v but options quoted and commands not executed
       -E                       Preprocess only; do not compile, assemble or link
       -S                       Compile only; do not assemble or link
       -c                       Compile and assemble, but do not link
       -o <file>                Place the output into <file>
       -x <language>            Specify the language of the following input files
                                Permissible languages include: c c++ assembler none
                                'none' means revert to the default behavior of
                                guessing the language based on the file's extension
     
     Options starting with -g, -f, -m, -O, -W, or --param are automatically
      passed on to the various sub-processes invoked by g++.  In order to pass
      other options on to these processes the -W<letter> options must be used.
     
     For bug reporting instructions, please see:
     <URL:http://gcc.gnu.org/bugs.html>.
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  3. #3
    Ethernal Noob
    Join Date
    Nov 2001
    Posts
    1,901
    oh jesus what is this stuff. Anyone recommend another compiler? I have the vs.net 7 but I wanted to try out some other compilers. This one I have no Idea what this is. Is there a good compiler that's easier to set up?

  4. #4
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    If you've installed Cygwin, and you are able to run gcc/g++ like I showed above, then you've a good compiler.

    Use a text editor to create your source files, then compiler like so:
    Code:
     $ cat junk1.c ; gcc junk1.c ; ./a.exe
     #include <stdio.h>
     
     int main(void)
     {
       puts("hello world");
       return(0);
     }
     hello world
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  5. #5
    Ethernal Noob
    Join Date
    Nov 2001
    Posts
    1,901
    what's GCC, G++? I odn't think that came with this one. It's hard for me to explain how difficult it is to do this, since I usually am used to doing things via gui interface. This command line stuff is wierd.

  6. #6
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    >>This command line stuff is wierd.
    Then you probably don't want to be using Cygwin
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  7. #7
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    If you're looking for an arguably easier variant of a windows port of gcc then try out MinGW. If you prefer a GUI interface then Blooshed's Dev-C++ is a popular ide and DevStudio bears an uncanny resemblance to msvc6. Both are free.
    CProgramming FAQ
    Caution: this person may be a carrier of the misinformation virus.

  8. #8
    Ethernal Noob
    Join Date
    Nov 2001
    Posts
    1,901
    it's not that I prefer a gui, but I want to learn how to use different compilers as well. I was checking out minGW btw. Though I noticed that devC++ didn't have iostream.h.

  9. #9
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    >>Though I noticed that devC++ didn't have iostream.h.<<

    With the 'current' MinGW version (3.1.0.1) it's in \include\c++\3.2.3\backward.

    >>but I want to learn how to use different compilers<<

    The faq lists some. You might be interested in taking a look at CBuilderX (personal version is free) which comes with bcc6 and an older version of MinGW. Coincidentally, this page describes how to configure it to use cygwin, but i've never tried it.
    CProgramming FAQ
    Caution: this person may be a carrier of the misinformation virus.

  10. #10
    Ethernal Noob
    Join Date
    Nov 2001
    Posts
    1,901
    *scratches head* Okay, I installed mingw...how do I get anywhere to compile anything.

  11. #11
    Registered User loopy's Avatar
    Join Date
    Mar 2002
    Posts
    172
    Quote Originally Posted by indigo0086
    *scratches head* Okay, I installed mingw...how do I get anywhere to compile anything.
    I would suggest to make things easier, you add the binarys of the package to your $PATH, if you have it (last time I used windows XP, I couldn't find 'autoexec.bat'), open up autoexec.bat, append to it:

    Code:
    PATH=c:\mingw\bin
    Or whatever the path to the binary directory is.

    : )

    Once thats done, you can open up a console and have 'gcc' available.

    {edit}

    I thought you had 'mingw', my mistake. : )
    Last edited by loopy; 05-12-2004 at 05:59 PM.
    WorkStation(new, a month ago):

    Sony Vaio i686 Desktop
    2.60 GIGhz Intel Pentium 4(HT)
    512Mb DDR RAM
    800MHz Front Side Bus!
    120 GIG IDE HardDrive
    Matrox G400 Dual-Head
    Linux kernel 2.6.3
    Modified Slackware 9.1
    GCC/GDB

    Multi-mon
    Simultaneous Multiple Processes

  12. #12
    Ethernal Noob
    Join Date
    Nov 2001
    Posts
    1,901
    in laymans. I got up to 'make things easier'

  13. #13
    Registered User loopy's Avatar
    Join Date
    Mar 2002
    Posts
    172
    Quote Originally Posted by indigo0086
    in laymans. I got up to 'make things easier'
    Open up 'C:\autoexec.bat', type in:

    Code:
    PATH=c:\mingw\bin\
    Replace with the correct path to the "bin" directory of your mingw package.

    If you don't have 'autoexec.bat', I don't know, maybe you can just create it.

    Hope that helps. : )
    WorkStation(new, a month ago):

    Sony Vaio i686 Desktop
    2.60 GIGhz Intel Pentium 4(HT)
    512Mb DDR RAM
    800MHz Front Side Bus!
    120 GIG IDE HardDrive
    Matrox G400 Dual-Head
    Linux kernel 2.6.3
    Modified Slackware 9.1
    GCC/GDB

    Multi-mon
    Simultaneous Multiple Processes

  14. #14
    Ethernal Noob
    Join Date
    Nov 2001
    Posts
    1,901
    Okay, did that, now where do I go. I went to command and gcc wasn't available when I typed it in.

  15. #15
    Registered User loopy's Avatar
    Join Date
    Mar 2002
    Posts
    172
    Quote Originally Posted by indigo0086
    Okay, did that, now where do I go. I went to command and gcc wasn't available when I typed it in.
    You might have to run autoexec.bat first, everytime you reboot/boot its read, since you've done neither, just run it.
    WorkStation(new, a month ago):

    Sony Vaio i686 Desktop
    2.60 GIGhz Intel Pentium 4(HT)
    512Mb DDR RAM
    800MHz Front Side Bus!
    120 GIG IDE HardDrive
    Matrox G400 Dual-Head
    Linux kernel 2.6.3
    Modified Slackware 9.1
    GCC/GDB

    Multi-mon
    Simultaneous Multiple Processes

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. NetBeans + Cygwin driving me insane
    By Del75 in forum C++ Programming
    Replies: 4
    Last Post: 08-17-2008, 05:03 AM
  2. cygwin sshd weird behavior
    By jEssYcAt in forum Tech Board
    Replies: 6
    Last Post: 05-19-2008, 02:05 PM
  3. Problems with compiling code in cygwin
    By firyace in forum C++ Programming
    Replies: 4
    Last Post: 06-01-2007, 08:16 AM
  4. Cygwin and coLinux
    By Mario F. in forum Tech Board
    Replies: 8
    Last Post: 07-03-2006, 02:00 PM
  5. Cygwin Server
    By osal in forum Networking/Device Communication
    Replies: 0
    Last Post: 03-07-2005, 12:58 PM