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 - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 12-14-2007, 12:32 PM   #1
mvnetn
LQ Newbie
 
Registered: Jul 2006
Location: State College, PA
Posts: 7

Rep: Reputation: 0
gcc setup


What have I failed to do in installing gcc on Debian.
Most recent version (4.0rev1 "etch")

My anal1.c file is as follows.

struct struct1 {
char nam[5];
char code[2];
unsigned long int date;
double open;
double high;
double low;
double close;
unsigned long int volume;};
struct1 struct2[750];


FILE *file = fopen("amex1.txt", "r");
if ( file != NULL )
{
char line [ 80 ];
size_t count, i = 0;
while ( i < 750 )
{
if ( fgets(line, sizeof line, file) == NULL )
{
break;
}
if ( sscanf(line, "%s,%s,%u,%d,%d,%d,%d,%u.%lf", struct1[i].nam, struct1[i].code,
struct1[i].date, struct1[i].open, struct1[i].high,
struct1[i].low, struct1[i].close, struct1[i].volume ) == 8 )
{
++i;
}
}
fclose(file);
for ( count = i, i = 0; i < count; ++i )
{
printf("struct1[%i]: nam = %s, code= %s, date = %u, open = %d, high = %d,low= %d, close= %d, volume = %u\n",
i, struct1[i].nam, struct1[i].code, struct1[i].date,
struct1[i].open, struct1[i].high, struct1[i].low, struct1[i].close, struct1[i].volume);
}
}
else
{
perror("amex1.txt");
}
return 0;
}

The folffowing output makes no sense

eric@debian:~/data$ gcc anal1.c
anal1.c: In function ‘main’:
anal1.c:18: error: ‘struct1’ undeclared (first use in this function)
anal1.c:18: error: (Each undeclared identifier is reported only once
anal1.c:18: error: for each function it appears in.)
anal1.c:18: error: expected ‘;’ before ‘struct2’
eric@debian:~/data$
 
Old 12-14-2007, 01:04 PM   #2
nirvana4ol
LQ Newbie
 
Registered: Dec 2007
Posts: 11

Rep: Reputation: 0
Hey,

Your code has lots of bugs.

Its not GCCs issue...

1) Your main fuction missing ??
2) struct structa { int x;...; };
struct structa structb; //This is the proper way of creating variables
3) you have used structa.x=3; which is wrong, use the variable, not the user defined data type.

Thats all
 
Old 12-15-2007, 06:47 AM   #3
mvnetn
LQ Newbie
 
Registered: Jul 2006
Location: State College, PA
Posts: 7

Original Poster
Rep: Reputation: 0
Thanks nirvana40l, you are right, my post did have many errors and they were not due to a gcc setup problem. For more information go to http://mysite.verizon.net/mvnetn/linux.

Last edited by mvnetn; 12-15-2007 at 06:49 AM.
 
Old 12-15-2007, 11:38 AM   #4
xlq
Member
 
Registered: Feb 2007
Distribution: Slackware 12.0
Posts: 58

Rep: Reputation: 15
Please use [CODE] tags
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
gcc wont install, 'failed dependencies: glibc-devel is needed by gcc-3.3.3-41' TdlSnare SUSE / openSUSE 3 11-29-2004 02:13 PM
Kernel compiling: gcc-3.3 is 586, should be gcc-3.3 386 Erik Plaggenmar Linux - Software 0 10-01-2004 11:38 AM
running software built with gcc 3.0.2 on Redhat 8 - gcc 3.2 dst1989 Linux - Software 3 03-08-2004 10:23 PM
a doubt with host gcc and arm-linux-gcc renjithgopal Linux - General 1 09-11-2003 04:02 PM
export CC=/usr/bin/gcc-3.2 - switch gcc version? ferreter Linux - Software 1 08-20-2003 12:07 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 12:38 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