gcc doesn like double quotes ¨

Asked by Greg Davis

Recently installed UBUNTU on my Dell laptop. Just started using the gcc compiler. For some reason I getting the following error messages:
main.c:9: error: stray ‘\302’ in program
main.c:9: error: stray ‘\250’ in program
main.c:9: error: stray ‘\302’ in program
main.c:9: error: stray ‘\250’ in program
main.c:9: error: ‘X’ undeclared (first use in this function)
main.c:9: error: (Each undeclared identifier is reported only once
main.c:9: error: for each function it appears in.)
main.c:11: error: stray ‘\302’ in program
main.c:11: error: stray ‘\250’ in program
main.c:11: error: expected expression before ‘%’ token
main.c:11: error: stray ‘\302’ in program
main.c:11: error: stray ‘\250’ in program

Line 9 is ch =¨X¨;
Line 11 is printf(¨num = %d¨,num);

This is a simple, or so I thought test program that I trying to compile - most of which I copied out of a book titled
TEACH YOURSELF C.

Here is the full program:

#include <stdio.h>
#include <math.h>

int main(void)
{
  char ch;
  int num;

  ch =¨X¨;
  num = 100;
  printf(¨num = %d¨,num);
  return 0;
}

I invoke gcc with the following command line:

gcc main.c -o myapp

Not sure if

Question information

Language:
English Edit question
Status:
Answered
For:
Ubuntu gcc-defaults Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Marshall Scorcio (marshalium) said :
#1

The character that you are using is actually an umlaut (¨) (unicode: \u00a8) not a double quote.

That character that you want to use is the standard double quote (") (unicode: \u0022).

If you change all of your umlauts to standard quotation marks your program will compile and run just fine.

Marshall

Revision history for this message
Greg Davis (davisga-20636) said :
#2

Marshall got me looking in the area - I was able to change the double quote to (") (unicode: \u0022) by using the shift key and hitting the " key followed by (while continuing to hold the shift key) the spacebar. This is leading me towards my initial selection of keyboard type while I was installing ubuntu.

Now I need to poke around to figure out how to change the keyboard type selection.

----- Original Message ----
From: Marshall Scorcio <email address hidden>
To: <email address hidden>
Sent: Saturday, October 18, 2008 2:00:31 AM
Subject: Re: [Question #48341]: gcc doesn like double quotes ¨

Your question #48341 on yelp in ubuntu changed:
https://answers.launchpad.net/ubuntu/+source/yelp/+question/48341

    Status: Open => Answered

Marshall Scorcio proposed the following answer:
The character that you are using is actually an umlaut (¨) (unicode:
\u00a8) not a double quote.

That character that you want to use is the standard double quote (")
(unicode: \u0022)..

If you change all of your umlauts to standard quotation marks your
program will compile and run just fine.

Marshall

--
If this answers your question, please go to the following page to let us
know that it is solved:
https://answers.launchpad.net/ubuntu/+source/yelp/+question/48341/+confirm?answer_id=0

If you still need help, you can reply to this email or go to the
following page to enter your feedback:
https://answers.launchpad.net/ubuntu/+source/yelp/+question/48341

You received this question notification because you are a direct
subscriber of the question.

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

Revision history for this message
Marshall Scorcio (marshalium) said :
#3

I found this thread:

http://ubuntuforums.org/showthread.php?p=2257421#post2257421

According to the thread reconfiguring console-setup will let you select the keyboard layout again:

sudo dpkg-reconfigure -plow console-setup

You can also change the layout in gnome preferences but I don't think it makes the changes system wide:

System -> Preferences -> Keyboard

Can you help with this problem?

Provide an answer of your own, or ask Greg Davis for more information if necessary.

To post a message you must log in.