Thread: Re: [Dev-C++] clrscr() and c99 compatibility
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: metalseb <met...@fr...> - 2002-09-23 10:28:49
|
Hi Matthews >I recently downloaded the new dev-c++ beta version, and am a bit stuck. >Looking through the included header files, I found a prototype for the >clrscr() function in conio.h, but trying to use clrscr() resulted in a >linker error. What header do I need to include to use clrscr()? You don't need more headers. You just have to link with libconio.a Linker errors are not related with missing ".h" headers. In this case, you get *compiler* errors, not *linker* ones. Project options/Linker options : -lconio >Also, I believe dev-c++ to be C99 compatible, but how come when I tried to >declare "char choice" halfway down a function, it gave me a parsing error? >C99 was supposed to allow variable declarations anywhere in the code. No problem here. Can you make a cut&paste of the snippet that causes you the problem ? Kind regards -- Seb |
|
From: metalseb <met...@fr...> - 2002-09-24 14:34:22
|
Good afternoon Matthew
>Code snippet: This happened several times with me, so I'm quite interested
>to find out the reason why.
>
>sample code:
>
>void log_in(void)
>{
> clrscr();
> printf("User login: ");
> char login[80];
> gets(login);
> int c;
> c = atoi(login);
> if (c != 0 || c != 1 || c != 2) {
> clrscr();
> printf("Invalid login.");
> for (;;) {
> if (kbhit()) break;
> }
> }
>}
>
>And it would give me a parsing error at "char login[80]" every time.
>What's up?
I tried it on my DevCpp 4.9.4.1 package and it gave me no compiling errors. And I really can't
see why this should gave you errors at compile time.
Kind regards
--
Seb
|
|
From: Per W. <pw...@ia...> - 2002-09-24 19:48:36
|
Check which version of gcc you are using. This isn't a problem if compiled
as c++ but definitely is when compiling with old gcc in c mode.
Traditional c doesn't allow variable declarations other than absolutely
first in a function.
/Per W
On Tue, 24 Sep 2002, metalseb wrote:
> Good afternoon Matthew
>
> >Code snippet: This happened several times with me, so I'm quite interested
> >to find out the reason why.
> >
> >sample code:
> >
> >void log_in(void)
> >{
> > clrscr();
> > printf("User login: ");
> > char login[80];
> > gets(login);
> > int c;
> > c = atoi(login);
> > if (c != 0 || c != 1 || c != 2) {
> > clrscr();
> > printf("Invalid login.");
> > for (;;) {
> > if (kbhit()) break;
> > }
> > }
> >}
> >
> >And it would give me a parsing error at "char login[80]" every time.
> >What's up?
>
> I tried it on my DevCpp 4.9.4.1 package and it gave me no compiling errors. And I really can't
> see why this should gave you errors at compile time.
>
> Kind regards
>
> --
> Seb
>
>
>
> -------------------------------------------------------
> This sf.net email is sponsored by:ThinkGeek
> Welcome to geek heaven.
> http://thinkgeek.com/sf
> _______________________________________________
> Dev-cpp-users mailing list
> Dev...@li...
> TO UNSUBSCRIBE: http://www.noicys.cjb.net/devcpp/ub.htm
> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
>
|
|
From: Ioannis V. <no...@ho...> - 2002-09-25 12:21:31
|
> -----Original Message-----
> From: dev...@li...
> [mailto:dev...@li...] On Behalf
> Of dev...@li...
> Sent: Tuesday, September 24, 2002 10:00 PM
> To: dev...@li...
> Subject: Dev-cpp-users digest, Vol 1 #986 - 4 msgs
>
> Message: 3
> Date: Tue, 24 Sep 2002 16:36:15 +0200
> To: Dev...@li...
> From: metalseb <met...@fr...>
> Subject: Re: [Dev-C++] clrscr() and c99 compatibility
> Reply-To: met...@fr...
>
> Good afternoon Matthew
>
> >Code snippet: This happened several times with me, so I'm
> quite interested
> >to find out the reason why.
> >
> >sample code:
> >
> >void log_in(void)
> >{
> > clrscr();
> > printf("User login: ");
> > char login[80];
> > gets(login);
> > int c;
> > c = atoi(login);
> > if (c != 0 || c != 1 || c != 2) {
> > clrscr();
> > printf("Invalid login.");
> > for (;;) {
> > if (kbhit()) break;
> > }
> > }
> >}
> >
> >And it would give me a parsing error at "char login[80]" every time.
> >What's up?
>
> I tried it on my DevCpp 4.9.4.1 package and it gave me no
> compiling errors. And I really can't
> see why this should gave you errors at compile time.
>
> Kind regards
>
> --
> Seb
I had problems with the mailing list for days so i missed the
discussion. However clrscr(), kbhit() are not ANSI/ISO C and the
definition of char login[80] in that place is only possible to
C99/C++98. The default for MINGW is C90 though. You must use the std=c99
switch to make it C99.
Ioannis
* Ioannis Vranos
* Programming pages: http://www.noicys.cjb.net
* Alternative URL: http://run.to/noicys
|
|
From: Matthews <dem...@uw...> - 2002-09-26 12:13:15
|
So what exactly do I have to do with this "std=c99" switch? Do I put it on
the compiler command line?
At 03:21 PM 25/09/2002 +0300, you wrote:
>> -----Original Message-----
>> From: dev...@li...
>> [mailto:dev...@li...] On Behalf
>> Of dev...@li...
>> Sent: Tuesday, September 24, 2002 10:00 PM
>> To: dev...@li...
>> Subject: Dev-cpp-users digest, Vol 1 #986 - 4 msgs
>>
>> Message: 3
>> Date: Tue, 24 Sep 2002 16:36:15 +0200
>> To: Dev...@li...
>> From: metalseb <met...@fr...>
>> Subject: Re: [Dev-C++] clrscr() and c99 compatibility
>> Reply-To: met...@fr...
>>
>> Good afternoon Matthew
>>
>> >Code snippet: This happened several times with me, so I'm
>> quite interested
>> >to find out the reason why.
>> >
>> >sample code:
>> >
>> >void log_in(void)
>> >{
>> > clrscr();
>> > printf("User login: ");
>> > char login[80];
>> > gets(login);
>> > int c;
>> > c = atoi(login);
>> > if (c != 0 || c != 1 || c != 2) {
>> > clrscr();
>> > printf("Invalid login.");
>> > for (;;) {
>> > if (kbhit()) break;
>> > }
>> > }
>> >}
>> >
>> >And it would give me a parsing error at "char login[80]" every time.
>> >What's up?
>>
>> I tried it on my DevCpp 4.9.4.1 package and it gave me no
>> compiling errors. And I really can't
>> see why this should gave you errors at compile time.
>>
>> Kind regards
>>
>> --
>> Seb
>
>
>
>I had problems with the mailing list for days so i missed the
>discussion. However clrscr(), kbhit() are not ANSI/ISO C and the
>definition of char login[80] in that place is only possible to
>C99/C++98. The default for MINGW is C90 though. You must use the std=c99
>switch to make it C99.
>
>
>
>Ioannis
>
>* Ioannis Vranos
>* Programming pages: http://www.noicys.cjb.net
>* Alternative URL: http://run.to/noicys
>
>
>-------------------------------------------------------
>This sf.net email is sponsored by:ThinkGeek
>Welcome to geek heaven.
>http://thinkgeek.com/sf
>_______________________________________________
>Dev-cpp-users mailing list
>Dev...@li...
>TO UNSUBSCRIBE: http://www.noicys.cjb.net/devcpp/ub.htm
>https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
>
|
|
From: Ioannis V. <no...@ho...> - 2002-09-26 14:57:58
|
> -----Original Message----- > From: Matthews [mailto:dem...@uw...] > Sent: Thursday, September 26, 2002 1:02 AM > To: no...@ho... > Subject: Re: [Dev-C++] clrscr() and c99 compatibility > > > So what exactly do I have to do with this "std=c99" switch? > Do I put it on > the compiler command line? Yes you will have to add -std=c99 as an additional command line parameter, if you want to use C99 for your .c files. Ioannis * Ioannis Vranos * Programming pages: http://www.noicys.cjb.net * Alternative URL: http://run.to/noicys |
|
From: Matthews <dem...@uw...> - 2002-10-03 02:41:30
|
After adding the -std=c99 option to my project's compiler options, it gave me the compiler error "Unknown C standard: c99" And it still didn't work. At 01:39 PM 26/09/2002 +0300, you wrote: >> -----Original Message----- >> From: Matthews [mailto:dem...@uw...] >> Sent: Thursday, September 26, 2002 1:02 AM >> To: no...@ho... >> Subject: Re: [Dev-C++] clrscr() and c99 compatibility >> >> >> So what exactly do I have to do with this "std=c99" switch? >> Do I put it on >> the compiler command line? > > >Yes you will have to add -std=c99 as an additional command line >parameter, if you want to use C99 for your .c files. > > >Ioannis > >* Ioannis Vranos >* Programming pages: http://www.noicys.cjb.net >* Alternative URL: http://run.to/noicys > > |
|
From: Ioannis V. <no...@ho...> - 2002-10-03 20:49:42
|
Well i am talking about the latest MINGW:
#include <stdio.h>
int main(void)
{
long long x=1;
printf("%lld\n", x);
}
C:\c>gcc -std=c99 -pedantic-errors temp.c -o temp
C:\c>temp
1
C:\c>
Btw, do you really like C99?
Ioannis
* Ioannis Vranos
* Programming pages: http://www.noicys.cjb.net
* Alternative URL: http://run.to/noicys
P.S.: The list unsubscribes me at will. If someone sent a message for me
in the list, please resend (at least with personal email).
> -----Original Message-----
> From: dev...@li...
> [mailto:dev...@li...] On Behalf
> Of Matthews
> Sent: Thursday, October 03, 2002 12:52 AM
> To: dev...@li...
> Subject: RE: [Dev-C++] clrscr() and c99 compatibility
>
>
> After adding the -std=c99 option to my project's compiler
> options, it gave
> me the compiler error "Unknown C standard: c99" And it still
> didn't work.
>
> At 01:39 PM 26/09/2002 +0300, you wrote:
> >> -----Original Message-----
> >> From: Matthews [mailto:dem...@uw...]
> >> Sent: Thursday, September 26, 2002 1:02 AM
> >> To: no...@ho...
> >> Subject: Re: [Dev-C++] clrscr() and c99 compatibility
> >>
> >>
> >> So what exactly do I have to do with this "std=c99" switch?
> >> Do I put it on
> >> the compiler command line?
> >
> >
> >Yes you will have to add -std=c99 as an additional command line
> >parameter, if you want to use C99 for your .c files.
> >
> >
> >Ioannis
> >
> >* Ioannis Vranos
> >* Programming pages: http://www.noicys.cjb.net
> >* Alternative URL: http://run.to/noicys
> >
> >
>
>
>
|
|
From: Matthews <dem...@uw...> - 2002-09-24 12:16:26
|
Thanks for the linker information. clrscr() along with textcolor() and
gotoxy() work fine now. :)
Code snippet: This happened several times with me, so I'm quite interested
to find out the reason why.
sample code:
void log_in(void)
{
clrscr();
printf("User login: ");
char login[80];
gets(login);
int c;
c = atoi(login);
if (c != 0 || c != 1 || c != 2) {
clrscr();
printf("Invalid login.");
for (;;) {
if (kbhit()) break;
}
}
}
And it would give me a parsing error at "char login[80]" every time.
What's up?
At 12:30 PM 23/09/2002 +0200, you wrote:
>Hi Matthews
>
>>I recently downloaded the new dev-c++ beta version, and am a bit stuck.
>>Looking through the included header files, I found a prototype for the
>>clrscr() function in conio.h, but trying to use clrscr() resulted in a
>>linker error. What header do I need to include to use clrscr()?
>
>You don't need more headers. You just have to link with libconio.a
>
>Linker errors are not related with missing ".h" headers. In this case, you
get *compiler* errors, not
>*linker* ones.
>
>Project options/Linker options : -lconio
>
>>Also, I believe dev-c++ to be C99 compatible, but how come when I tried to
>>declare "char choice" halfway down a function, it gave me a parsing error?
>>C99 was supposed to allow variable declarations anywhere in the code.
>
>No problem here. Can you make a cut&paste of the snippet that causes you
the problem ?
>
>Kind regards
>
>--
>Seb
>
>
>
>
>
>-------------------------------------------------------
>This sf.net email is sponsored by:ThinkGeek
>Welcome to geek heaven.
>http://thinkgeek.com/sf
>_______________________________________________
>Dev-cpp-users mailing list
>Dev...@li...
>TO UNSUBSCRIBE: http://www.noicys.cjb.net/devcpp/ub.htm
>https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
>
|