ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Then go to Start -> Run, type cmd and press ENTER.
Then type c:\, press ENTER.
Then compile your program with gcc.
It doesn't have to be c:\, but you have to navigate to the directory. You can't just try to compile samp.c from anywhere. What if you have more than one file called samp.c on your harddrive? That's why the directory structure exists in the first place. Learn it, use it, own it.
You definitely do have gcc installed, and within your path ? (What happens when you just type gcc <enter> into a shell ?)
when I do that it's says 'No Input file'
itsme86 - the files saved within my H drive, I've tried running it, by stating the complete address of the file, for example gcc h:\samp -o samp.exe, but I still get the same problem
bm17 - I try what you said but I don't see how it's going to make much of a difference
How did you install the compiler? Are you using Cygwin? If so, I think you need to be running in some sort of shell enviroment for unix commands to work. The README file or googling for "cygwin" should point you in the right direction.
gcc is a command-line program. You need to invoke it from the shell, or DOS prompt. Depending on what flavor of gcc it is, it will use certain environment variables to locate the files it needs in order to operate. For instance, it needs to know where to find the include files. You need to find out what kind of gcc installation this is.
Running raw gcc is an advanced issue if you are used to Windows packaged GUI applications. Perhaps you would be better served with a copy of Visual Studio. Failing that, find out who installed gcc, ask them where it came from, and then read the instructions for using it. I admit that this is a complicated problem, but gcc simply wasn't intended to be used directly from a windowed environment without running some sort of setup script first.
If you are just trying to experiment with the C language then you should create a DOS window/session (or command prompt, or whatever they call it these days) and type the name of the command (test). If you do not run it at the command prompt then you will not be able to see the output. I think that the cygwin compiler has an option to create a terminal window when you run the program, but I do not know how to invoke that option.
Originally posted by itsme86 There's no such thing.
That is not entirely true. The floating point binary format allows for several special values, including infinity, negative infinity, and NaN (Not a Number, or "undefined"). They are obscure and only heavy-math guys use them. I know how to use these values with C++ but C is not so clear to me. My understanding is that you include math.h and use the macro INFINITY. You can do a google search for "C language float infinity" for more information.
Most people's first programs do not take numeric cardinality into consideration. Good show!
But I suspect I am missing something here. In what context do you need to use infinity? Are you talking about an infinite loop?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.