LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 11-16-2010, 10:07 AM   #1
jone kim
Member
 
Registered: Apr 2010
Posts: 185

Rep: Reputation: 16
problem with GCC compiler


I am facing an amazing problem with GCC compiler. When I copy any C code from any documents or texts and paste at gedit and try to compile it with using GCC compiler, it gives error. But when I typed the same code, it executes.
Why is it so??
 
Old 11-16-2010, 10:11 AM   #2
kvm1983
Member
 
Registered: Jul 2009
Posts: 47

Rep: Reputation: 1
What's the error u get ? We could point out what's going wrong only after looking at it.
 
Old 11-16-2010, 10:12 AM   #3
Lis
LQ Newbie
 
Registered: Nov 2010
Posts: 15

Rep: Reputation: 1
Can you provide the gcc error message, which is print when you compile the pasted code?
 
Old 11-18-2010, 06:11 AM   #4
jone kim
Member
 
Registered: Apr 2010
Posts: 185

Original Poster
Rep: Reputation: 16
I copied a simple code from .doc file:
#include <stdio.h>
#include <unistd.h>

int main ()
{
**printf("Hello Worldn");
**fork();
**printf("Goodbye Cruel Worldn");
}

When I compiled it, I got the following error message:

/Desktop$ gcc -o lab.o lab.c
lab.c: In function ‘main’:
lab.c:6: error: stray ‘\302’ in program
lab.c:6: error: stray ‘\240’ in program
lab.c:6: error: stray ‘\302’ in program
lab.c:6: error: stray ‘\240’ in program
lab.c:7: error: stray ‘\302’ in program
lab.c:7: error: stray ‘\240’ in program
lab.c:7: error: stray ‘\302’ in program
lab.c:7: error: stray ‘\240’ in program
lab.c:8: error: stray ‘\302’ in program
lab.c:8: error: stray ‘\240’ in program
lab.c:8: error: stray ‘\302’ in program
lab.c:8: error: stray ‘\240’ in program
But when I wrote the same code, it executed. How's that??
 
Old 11-18-2010, 06:16 AM   #5
jone kim
Member
 
Registered: Apr 2010
Posts: 185

Original Poster
Rep: Reputation: 16
Can I know the control flow of my program via GCC compiler like in turbo C compiler. I mean that can I know which part of the code is executing at present and where does the flow of my program is going?????
 
Old 11-18-2010, 10:09 AM   #6
kvm1983
Member
 
Registered: Jul 2009
Posts: 47

Rep: Reputation: 1
there are some stray characters in your program. I can already see a
**printf, why do u have the two '*'s there?

In general, when you copy from a doc file , it copies some format specific characters. You can open this in an editor like vi and emacs and view them.

- Kshitij
 
Old 11-18-2010, 07:26 PM   #7
jestinjoy
Member
 
Registered: May 2004
Location: India
Distribution: Ubuntu 9.04, Debian Lenny
Posts: 121

Rep: Reputation: 22
The problem usually occuring is that double quotes changes when you copy it from doc file to gedit file. Hope changing it works for you. Also remove the "**" in the program.Execute it and please post back the output.

Last edited by jestinjoy; 11-18-2010 at 07:27 PM.
 
  


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
Help: Open Solaris gcc compiler problem Infasoft Solaris / OpenSolaris 7 08-29-2008 02:21 AM
GCC Compiler problem ELPDave Debian 6 06-01-2007 06:53 PM
gcc compiler problem greengrocer Linux - Newbie 5 07-06-2006 05:20 AM
Gcc Compiler Problem mjkramer Linux - Software 6 10-24-2003 08:48 PM
gcc compiler install problem mla Linux - Software 4 10-11-2003 07:03 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 09:03 PM.

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