Results 1 to 4 of 4
I'm using a knoppix live cd (recommended by uni) to compile and run c programs off a usb drive - practice makes perfect. I get compile error messages when not ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 09-21-2006 #1Just Joined!
- Join Date
- Sep 2006
- Posts
- 2
How to compile and run C with Knoppix Live
I'm using a knoppix live cd (recommended by uni) to compile and run c programs off a usb drive - practice makes perfect. I get compile error messages when not done properly, warning messages, etc which is good. But when I try to run the program nothing happens. So for example, to compile test.c (which displays a simple printf statement), I would type:
$ gcc -o test test.c
Then to run the program, I type:
$ test
And nothing happens. It just goes to the next line, ready to take in another command. Why?
- 09-22-2006 #2
because you're running the linux command test and not your own test program. linux doesn't look in the directory by default. it first looks in /bin, then /usr/bin (and any other predefined directories) but never the current directory. to tell it to run the file from the current directory, use
note the ./ and not just /Code:./test
the . tells linux to look in the current directory. you can also give the pathname relative to the directory. say you are in /home/user and the file is in /home/user/prog/test you will run
to execute the code.Code:prog/test
Here's why Linux is easier than Windows:
Package Managers! Apt-Get and Portage (among others) allow users to install programs MUCH easier than Windows can.
Hardware Drivers. In SuSE, ALL the hardware is detected and installed automatically! How is this harder than Windows' constant disc changing and rebooting?
- 09-23-2006 #3Just Joined!
- Join Date
- Sep 2006
- Posts
- 2
That makes perfect sense. Thanks.
- 09-25-2006 #4Just Joined!
- Join Date
- May 2005
- Posts
- 48
d38dm8nw81k1ng is correct that the path needs to be emphasized with ./.
However, the name test is not a unique name cause it conflicts with bash.
If you used say like test1 or test\ 1 or whatever then it would have worked.
BTW, permissions should be perused also.


Reply With Quote
