public inbox for cygwin-xfree@sourceware.org
help / color / mirror / Atom feed
* "Erreur" messages when trying to compile
@ 2013-02-18 14:26 jere95
  2013-02-18 14:43 ` Jack
  0 siblings, 1 reply; 5+ messages in thread
From: jere95 @ 2013-02-18 14:26 UTC (permalink / raw)
  To: cygwin-xfree

Hi,
I am new to programming and I downloaded cygwin, because I heard it was a
good gcc compiler. At the moment I am reading this O'reilly book on C, and I
tried compiling the folowing exemple programme out of the book :

When I try to compile, this c file, typing : /gcc cards.c -o cards/ , the
cygwin terminal answers :



What is the problem?



--
View this message in context: http://cygwin.1069669.n5.nabble.com/Erreur-messages-when-trying-to-compile-tp96267.html
Sent from the cygwin-xfree mailing list archive at Nabble.com.

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://x.cygwin.com/docs/
FAQ:                   http://x.cygwin.com/docs/faq/


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: "Erreur" messages when trying to compile
  2013-02-18 14:26 "Erreur" messages when trying to compile jere95
@ 2013-02-18 14:43 ` Jack
  2013-02-18 15:18   ` Mark Hansen
  0 siblings, 1 reply; 5+ messages in thread
From: Jack @ 2013-02-18 14:43 UTC (permalink / raw)
  To: cygwin-xfree; +Cc: jere95

On 2013.02.18 09:26, jere95 wrote:
> Hi,
> I am new to programming and I downloaded cygwin, because I heard it  
> was a
> good gcc compiler. At the moment I am reading this O'reilly book on  
> C, and I
> tried compiling the folowing exemple programme out of the book :
> 
> When I try to compile, this c file, typing : /gcc cards.c -o cards/ ,  
> the
> cygwin terminal answers :
> 
> 
> 
> What is the problem?
For some reason, your examples are not coming through to the mailing  
list.

However, it looks like the messages are very clear.  You seem to be  
using "(" (left parenthesis) instead of "{" (left curly brace) on many  
lines.  gcc is expecting a closing parenthesis before the next  
semicolon, and it is expecting a semicolon  before the next closing  
curly brace.

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://x.cygwin.com/docs/
FAQ:                   http://x.cygwin.com/docs/faq/


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: "Erreur" messages when trying to compile
  2013-02-18 14:43 ` Jack
@ 2013-02-18 15:18   ` Mark Hansen
  2013-02-18 15:37     ` jere95
  0 siblings, 1 reply; 5+ messages in thread
From: Mark Hansen @ 2013-02-18 15:18 UTC (permalink / raw)
  To: cygwin-xfree

On 2/18/2013 6:42 AM, Jack wrote:
> On 2013.02.18 09:26, jere95 wrote:
>> Hi,
>> I am new to programming and I downloaded cygwin, because I heard it  
>> was a
>> good gcc compiler. At the moment I am reading this O'reilly book on  
>> C, and I
>> tried compiling the folowing exemple programme out of the book :
>> 
>> When I try to compile, this c file, typing : /gcc cards.c -o cards/ ,  
>> the
>> cygwin terminal answers :
>> 
>> 
>> 
>> What is the problem?
> For some reason, your examples are not coming through to the mailing  
> list.
> 
> However, it looks like the messages are very clear.  You seem to be  
> using "(" (left parenthesis) instead of "{" (left curly brace) on many  
> lines.  gcc is expecting a closing parenthesis before the next  
> semicolon, and it is expecting a semicolon  before the next closing  
> curly brace.

Yes, here is his example program:

#include<stdio.h>
#include<stdlib.h>
int main()
{
	char card_name[ 3];
	puts("Enter the card_name: ");
	scanf("%2s", card_name);
	int val = 0;
	if (card_name[0] == 'K') (
		val = 10;
	} else if (card_name[0] == 'Q') (
		val = 10;
	} else if (card_name[0] == 'J') (
		val = 10;
	}else if (card_name[0] == 'A') (
		val = 11;
	}else (
		val = atoi(card_name);
	}
	printf("The card value is: %i\n", val);
	return 0;
	}

Look at this line, for example:

	if (card_name[0] == 'K') (

My guess is that you typed this in by hand, and didn't see clearly
that the last character should have been an open brace '{' rather
than an open parentheses '('. It looks like you've made the same
error in several other places.


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://x.cygwin.com/docs/
FAQ:                   http://x.cygwin.com/docs/faq/


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: "Erreur" messages when trying to compile
  2013-02-18 15:18   ` Mark Hansen
@ 2013-02-18 15:37     ` jere95
  2013-02-19  0:46       ` Christopher Faylor
  0 siblings, 1 reply; 5+ messages in thread
From: jere95 @ 2013-02-18 15:37 UTC (permalink / raw)
  To: cygwin-xfree



Thanks a lot I was able to solve the problem!


________________________________
 De : Mark Hansen-4 [via Cygwin] <ml-node+s1069669n96269h13@n5.nabble.com>
À : jere95 <jeremy120895@yahoo.fr> 
Envoyé le : Lundi 18 février 2013 16h19
Objet : Re: "Erreur" messages when trying to compile
 

On 2/18/2013 6:42 AM, Jack wrote: 

> On 2013.02.18 09:26, jere95 wrote: 
>> Hi, 
>> I am new to programming and I downloaded cygwin, because I heard it   
>> was a 
>> good gcc compiler. At the moment I am reading this O'reilly book on   
>> C, and I 
>> tried compiling the folowing exemple programme out of the book : 
>> 
>> When I try to compile, this c file, typing : /gcc cards.c -o cards/ ,   
>> the 
>> cygwin terminal answers : 
>> 
>> 
>> 
>> What is the problem? 
> For some reason, your examples are not coming through to the mailing   
> list. 
> 
> However, it looks like the messages are very clear.  You seem to be   
> using "(" (left parenthesis) instead of "{" (left curly brace) on many   
> lines.  gcc is expecting a closing parenthesis before the next   
> semicolon, and it is expecting a semicolon  before the next closing   
> curly brace. 
Yes, here is his example program: 

#include<stdio.h> 
#include<stdlib.h> 
int main() 
{ 
        char card_name[ 3]; 
        puts("Enter the card_name: "); 
        scanf("%2s", card_name); 
        int val = 0; 
        if (card_name[0] == 'K') ( 
                val = 10; 
        } else if (card_name[0] == 'Q') ( 
                val = 10; 
        } else if (card_name[0] == 'J') ( 
                val = 10; 
        }else if (card_name[0] == 'A') ( 
                val = 11; 
        }else ( 
                val = atoi(card_name); 
        } 
        printf("The card value is: %i\n", val); 
        return 0; 
        } 

Look at this line, for example: 

        if (card_name[0] == 'K') ( 

My guess is that you typed this in by hand, and didn't see clearly 
that the last character should have been an open brace '{' rather 
than an open parentheses '('. It looks like you've made the same 
error in several other places. 


-- 
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://x.cygwin.com/docs/
FAQ:                   http://x.cygwin.com/docs/faq/



________________________________
 
If you reply to this email, your message will be added to the discussion below:http://cygwin.1069669.n5.nabble.com/Erreur-messages-when-trying-to-compile-tp96267p96269.html 
To unsubscribe from "Erreur" messages when trying to compile, click here.
NAML



--
View this message in context: http://cygwin.1069669.n5.nabble.com/Erreur-messages-when-trying-to-compile-tp96267p96271.html
Sent from the cygwin-xfree mailing list archive at Nabble.com.

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://x.cygwin.com/docs/
FAQ:                   http://x.cygwin.com/docs/faq/


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: "Erreur" messages when trying to compile
  2013-02-18 15:37     ` jere95
@ 2013-02-19  0:46       ` Christopher Faylor
  0 siblings, 0 replies; 5+ messages in thread
From: Christopher Faylor @ 2013-02-19  0:46 UTC (permalink / raw)
  To: cygwin-xfree

On Mon, Feb 18, 2013 at 07:37:22AM -0800, jere95 wrote:
>
>
>Thanks a lot I was able to solve the problem!

For the record:

1) This is a simple C programming problem which should not be sent to
a mailing list.  You should fix these types of problems yourself.

2) If that wasn't enough to make this off-topic, you are sending this
to the "cygwin-xfree" mailing list.  C compilation problems have nothing
to do with this mailing list.

cgf

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://x.cygwin.com/docs/
FAQ:                   http://x.cygwin.com/docs/faq/


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-02-19  0:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-18 14:26 "Erreur" messages when trying to compile jere95
2013-02-18 14:43 ` Jack
2013-02-18 15:18   ` Mark Hansen
2013-02-18 15:37     ` jere95
2013-02-19  0:46       ` Christopher Faylor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).