Cygwin (Unix Emulator)

Associate
Joined
28 Jul 2003
Posts
1,987
Location
The Moon
Ok here's the deal. I am a complete beginner in terms of programming and as a result, know nothing about it. As part of my degree I have to learn C programming and am finding it a little difficult to get my head round. We are using a programme called Cygwin on our computers at university, apparently it is a unix emulator. Whatever that means. Anyhow I have installed this Cygwin programme onto my own laptop, however, whenever I try to compile, I get an error message saying "bash: comman not found". I have no idea how to resolve this problem.

I am really beginning to hate c programming, I have never done anything like this in my life before and just do not understand it. The whole point of my installing Cygwin onto my laptop was so I could spend time at home learning how to use it. Basically I am asking if anybody here as an idea as to why it will not let me compile?
 
SoSolid said:
Ok here's the deal. I am a complete beginner in terms of programming and as a result, know nothing about it. As part of my degree I have to learn C programming and am finding it a little difficult to get my head round. We are using a programme called Cygwin on our computers at university, apparently it is a unix emulator. Whatever that means. Anyhow I have installed this Cygwin programme onto my own laptop, however, whenever I try to compile, I get an error message saying "bash: comman not found". I have no idea how to resolve this problem.

I am really beginning to hate c programming, I have never done anything like this in my life before and just do not understand it. The whole point of my installing Cygwin onto my laptop was so I could spend time at home learning how to use it. Basically I am asking if anybody here as an idea as to why it will not let me compile?

Funny thing is, I've only just reinstalled this C++ compiler today (took some fiddling too!) and it's working fine for me. Make sure when you run Cygwin's "setup.exe" to ensure you install the package called "Devel" as this has the C++ compiler which will allow you to compile your C/C++ code. Depending on what editor/interface you use to code your programs, you might need to edit the environmental variables in Windows and set the paths accordingly so that you can use the compiler - Hence the "Command Not Found Error".
 
kbc said:
Funny thing is, I've only just reinstalled this C++ compiler today (took some fiddling too!) and it's working fine for me. Make sure when you run Cygwin's "setup.exe" to ensure you install the package called "Devel" as this has the C++ compiler which will allow you to compile your C/C++ code. Depending on what editor/interface you use to code your programs, you might need to edit the environmental variables in Windows and set the paths accordingly so that you can use the compiler - Hence the "Command Not Found Error".

Thanks for the help, managed to get it to compile now. I now, however, have another problem. It gives me the bash: command not found, message when I try to run the program. Do you know what is causing this, did i miss out installing something?
 
SoSolid said:
Thanks for the help, managed to get it to compile now. I now, however, have another problem. It gives me the bash: command not found, message when I try to run the program. Do you know what is causing this, did i miss out installing something?


never used cywin, but if it emulates unix you need to give sufficent access rights to the file you want to run.

to do this type

chmod u+x name_of_file

then try running the file
 
Hey this does not seem to work, I cannot execute the program once I have written them. Anyone have any ideas as this is become a pressing issue for me? :confused:
 
cygwin seems over kill for what you want to do.

to simply compile C programs i use bloodshed's dev-C++ IDE.

it's a simple editor that will compile and run your programs with clicks of the mouse.

when you're back in college ask a lecturer or a lab supervisor on how to install compilers in cgywin.
 
Last edited:
cremo said:
cygwin seems over kill for what you want to do.

to simply compile C programs i use bloodshed's dev-C++ IDE.

it's a simple editor that will compile and run your programs with clicks of the mouse.

when you're back in college ask a lecturer or a lab supervisor on how to install compilers in cgywin.
I want to use cygwin because it's the same program as we have to use at uni. We have a test in c programming coming up and I need to practice badly. I have managed to install the compilers and they work fine, the problem is running the program, it wont let me run it once i have compiled it.
 
Which command are you using to compile your code?

It should be something like gcc -o outputfile inputfile.cc for a simple program.

Then it should be a case of chmod +x outputfile and then ./outputfile to run it.
 
FirebarUK said:
As said, your probably typing in;

filename

to try and run your app, when it should be;

./filename

when in the correct directory.
But I am using the same command as I use at uni and it does not work on my laptop but yet it works at uni. The command to run a program on cygwin is a.exe and the it should run. However, it does not recognise this command on my laptop....even though the same program but run on my uni computer, does.

Edit: would it be ok to just us microsoft visual c#? Will all of the command remain the same? I think that they will.
 
Last edited:
Ok I am now using dev c++ and it compiles fine but when i try to run the file it quickly loads up the black dos style window and then shuts, in a less amount of time than it takes to blink. Please can someone help me as this is starting to do my head in.
 
The reason this is happening is because the program runs, but the window then closes as soon as the program has exited.

You could either try opening the cmd prompt and running from within that (start -> run -> type CMD, naviagte to the dir your program is in and run from there), or add something like

Code:
getchar()

to the end of your program, so that your program waits for a key to be pressed before exiting.
 
Chrisss said:
The reason this is happening is because the program runs, but the window then closes as soon as the program has exited.

You could either try opening the cmd prompt and running from within that (start -> run -> type CMD, naviagte to the dir your program is in and run from there), or add something like

Code:
getchar()

to the end of your program, so that your program waits for a key to be pressed before exiting.
I tried to access cmd but everytime I try to, my computer says that the file is currently in use and wont let me open it?
 
Back
Top Bottom