LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 12-31-2011, 06:20 PM   #1
Pl3th0r4x
Member
 
Registered: Dec 2011
Location: Land of Derk
Distribution: Derka
Posts: 71

Rep: Reputation: 0
C Compiler Will Not Run/Please Help?


I know I am new here, but I hope someone can please help me start?

sudo aptitude install build-essential
sudo gedit first.c

Up until this point everything seems fine except when I save it the code I get this report:

Code:
(gedit:2977): Gtk-WARNING **: Attempting to store changes into `/root/.local/share/recently-used.xbel', but failed: Failed to create file '/root/.local/share/recently-used.xbel.EDN36V': No such file or directory

(gedit:2977): Gtk-WARNING **: Attempting to set the permissions of `/root/.local/share/recently-used.xbel', but failed: No such file or directory

(gedit:2977): Gtk-WARNING **: Attempting to store changes into `/root/.local/share/recently-used.xbel', but failed: Failed to create file '/root/.local/share/recently-used.xbel.KE136V': No such file or directory

(gedit:2977): Gtk-WARNING **: Attempting to set the permissions of `/root/.local/share/recently-used.xbel', but failed: No such file or directory

Following the rest to run the file results:

cc -c first.c

Code:
first.c: In function ‘main’:
first.c:5:7: error: expected ‘;’ before ‘{’ token

cc -o first first.c

Code:
first.c: In function ‘main’:
first.c:5:7: error: expected ‘;’ before ‘{’ token

./first

Code:
bash: ./file: No such file or directory


Output should show as follows

Hello, world


... but it is not.

-----

Also I added

sudo apt-get install gcc build-essential

To install gcc, but I have the same results.

----

*Notes*

using Ubuntu 11.10
 
Old 12-31-2011, 06:57 PM   #2
AlucardZero
Senior Member
 
Registered: May 2006
Location: USA
Distribution: Debian
Posts: 4,824

Rep: Reputation: 615Reputation: 615Reputation: 615Reputation: 615Reputation: 615Reputation: 615
(a) should be harmless. It seems that /root/.local/share/recently-used.xbel or the path to it doesn't exist, though.
(b) you have a syntax error and the compile is failing. It seems you are missing a ;.
(c) of course ./first won't be found, when the compile errored out.
 
1 members found this post helpful.
Old 12-31-2011, 07:25 PM   #3
dwhitney67
Senior Member
 
Registered: Jun 2006
Location: Maryland
Distribution: Kubuntu, Fedora, RHEL
Posts: 1,541

Rep: Reputation: 335Reputation: 335Reputation: 335Reputation: 335
Quote:
Originally Posted by Pl3th0r4x View Post
I know I am new here, but I hope someone can please help me start?
The first, and perhaps best, advice I can give right now would be for you to refrain editing (and compiling) source code as the root user. It is not necessary. Develop s/w using a regular user account. Thus to edit your file, use something like the following (without the sudo!):
Code:
gedit first.c
And then as AlucardZero indicated, your code has a syntax error within it. I would recommend that you correct it. If you have doubts about how to do this, then post your code here within CODE tags so that we can analyze it.
 
1 members found this post helpful.
Old 01-01-2012, 11:29 AM   #4
Pl3th0r4x
Member
 
Registered: Dec 2011
Location: Land of Derk
Distribution: Derka
Posts: 71

Original Poster
Rep: Reputation: 0
Thanks for the valuable replies.
Here is the code which I did have a syntax error which I have now gotten in order.

Code:
#include <stdio.h>

int main()
{
printf("Hello, world\n");
return 0;
}
"after printf" I had one of these "{" instead of this "("

I do not see where I am missing a colon, and I am not running this in root I do not know why it says, "root/.local/share/recently-used.xbel"

This did give the result

Hello, world

Within my Terminal. Thank you for your time and if you have anything else you would like to share feel free to discuss. I could use all the advice available.
 
Old 01-01-2012, 11:42 AM   #5
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443
Blog Entries: 3

Rep: Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723
Quote:
Originally Posted by Pl3th0r4x View Post
and I am not running this in root I do not know why it says, "root/.local/share/recently-used.xbel"
Yes you were:

Quote:
Originally Posted by Pl3th0r4x View Post
sudo gedit first.c
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to run D compiler prjctl Programming 2 05-12-2010 01:30 PM
Help me!! is there any compiler for vb.net in able to run in linux? jetro2k5 Linux - Software 3 04-05-2007 09:57 AM
How to run my compiler BobNutfield Linux - Newbie 2 01-11-2006 07:11 AM
C compiler cannot run C compiled programs petero Programming 8 05-27-2005 11:35 AM
how do i run my c compiler fhameed Linux - Software 2 11-16-2003 11:06 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:56 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration