Question:
Need help with Ubuntu C Program?
anonymous
2009-02-03 14:01:01 UTC
Okay, I have no frickin clue how to use Ubuntu.

http://senduit.com/51d5a2

Please visit that link and download my code. Help me compile it and if possible...correct any errors with the code itself. I'm not so good at writing C programs either.

Send me the source file and executable file. Make sure it works on Ubuntu.

My e-mail address is needcash4school@gmail.com

Thanks.
Four answers:
jplatt39
2009-02-03 15:06:24 UTC
First if you have no clue how to use Ubuntu HAVE you downloaded build-essential? If not, open a terminal and type "sudo apt-get build-essential".



Once you have done that, type "gcc -o temp {or whatever you want to name it} source.c". If you have not used the -o switch you will get a file in your directory called a.out. That is the default name for all GCC programs. I get two errors.



sourcecode.c: In function 'main':

sourcecode.c:22: error: expected ';' before '}' token

sourcecode.c:29:2: warning: no newline at end of file



The first one means the line



printf("%d degrees celsius is equal to %1f degrees fahrenheit.\n", degrees, fahrenheit) }



should be:



printf("%d degrees celsius is equal to %1f degrees fahrenheit.\n", degrees, fahrenheit); }



That is a semicolon before the close bracket.



I could tell you about logfiles and redirecting the error messages to a file (search for the symbols 2>&1 which means redirect stderr to stdout) and I could tell you about the debugger gdb (after you have build essential type "info gdb") but I won't.
maritza
2016-05-28 12:51:07 UTC
VIM isn't that bad once you get used to it so you may want to try it out. I don't know of any good linux IDEs though. You may or may not need to set up a c++ compiler on ubuntu. Search through your package manager for "g++", that is a good c++ compiler. I'm not sure about a c compiler but I'm positive there is one in there.
anonymous
2009-02-03 14:53:15 UTC
There's nothing scary in that code. it won't even compile unmodified (missing semicolon). There were a bunch more errors that I fixed. Check out: http://codepad.org/Z16Hq5XB for the detailed fixes.
Jessica Queller
2009-02-03 14:06:29 UTC
This looks phishy. I wouldn't download and compile your code, and I don't think anyone here should either. Sorry.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...