Chinaunix首页 | 论坛 | 博客
  • 博客访问: 893826
  • 博文数量: 132
  • 博客积分: 9976
  • 博客等级: 中将
  • 技术积分: 1781
  • 用 户 组: 普通用户
  • 注册时间: 2007-08-30 20:40
文章分类

全部博文(132)

文章存档

2013年(1)

2011年(1)

2010年(15)

2009年(77)

2008年(36)

2007年(2)

我的朋友

分类: C/C++

2009-02-24 15:34:35


My C error log

1. error: expected declaration or statement at end of input
2. error: gnu/stubs-32.h: No such file or directory
3. could not find output section .gnu.hash

========================================================================
1. error: expected declaration or statement at end of input

ccache i386-linux-uclibc-gcc -g -O2 -pipe -march=i486 -funit-at-a-time -g3 -I/opt/chjdoc/fos/trunk/build_dir/linux-x86_generic/linux-2.6.25.17/include -I../GPIO -Wall -c -o gpio_fpga.o gpio_fpga.c
gpio_fpga.c: In function 'discrypt_encrypted_bin_file':
gpio_fpga.c:681: warning: 'main' is normally a non-static function
gpio_fpga.c:855: error: expected declaration or statement at end of input
make[1]: *** [gpio_fpga.o] Error 1
-------------------------------------------------------------------------
from:
   
error: expected declaration or statement at end of input ?

[Log in to get rid of this advertisement]
We are trying to compile this program and we keep getting the same error, we can't find where the problem is can somenone help us please.
Thanks a lot

#include
#include
struct vino{
char nombre[30];
char tipo[15];
char nacionalidad[15];
char sabor[15];};





void leer(FILE* archivo, struct vino mibodega[7]){
int i; i=0;
while (i<7){

fscanf(archivo, "%s",mibodega[i].nombre);
fscanf(archivo, "%s",mibodega[i].tipo);
fscanf(archivo, "%s",mibodega[i].nacionalidad);
fscanf(archivo, "%s",mibodega[i].sabor);
i++;
}


int main(void){
FILE* f=fopen("vinos.txt","r");

int i,j;
struct vino mibodega[7];
leer (f,mibodega);
printf("%s", mibodega[4].sabor);
}

   
I believe you are missing an } before main
   
Quote:
Code:

#include
#include
struct vino{
char nombre[30];
char tipo[15];
char nacionalidad[15];
char sabor[15];};

void leer(FILE* archivo, struct vino mibodega[7]){
int i; i=0;
}
while (i<7){

fscanf(archivo, "%s",mibodega[i].nombre);
fscanf(archivo, "%s",mibodega[i].tipo);
fscanf(archivo, "%s",mibodega[i].nacionalidad);
fscanf(archivo, "%s",mibodega[i].sabor);
i++;
}


int main(void){
FILE* f=fopen("vinos.txt","r");

int i,j;
struct vino mibodega[7];
leer (f,mibodega);
printf("%s", mibodega[4].sabor);
}

The red brace is the one you are missing. I had this error come up in a program I was working on the other day.
   
Thanks a lot, we've manage to solve the problems and complete the program of the expert systems.
Thanks to all
=========================================================================
2. error: gnu/stubs-32.h: No such file or directory

from:

x86_64 Linux Error: gnu/stub-32.h missing error and solution

by Vivek Gite

Q. I'm getting the following error while compiling application under CentOS / RHEL / Fedora Linux 64 bit edition:

    /usr/include/gnu/stubs.h:7:27: error: gnu/stubs-32.h:

    No such file or directory

How do I fix this error?

A. You need to install the glibc-devel package. It contains the object files necessary for developing programs
which use the standard C libraries (which are used by nearly all programs). If you are developing programs which
will use the standard C libraries, your system needs to have these standard object files available in order to
create the executables.

Install glibc-devel if you are going to develop programs which will use the standard C libraries.
# yum -y install glibc-devel
Now again try to recompile application.

Want to read Linux tips and tricks, but don't have time to check our blog everyday? Subscribe to our daily email
newsletter to make sure you don't miss a single tip/tricks. Subscribe to our weekly newsletter here!

    * Email FAQ to a friend
    * Printable version
    * Rss Feed
    * Last Updated: 9-4-08

{ 1 comment… read it below or add one }

1 allan 04.03.09 at 7:41 pm

    you might want to install glibc-devel.i386 (even if you’re on x64) to fix this problem
=========================================================================
from:


 Par défaut  Compilation/Linking issues
Hi Doc, hi all,

I tried to compile V2.01 and now V2.10 on OpenSuSE 10.3 64bit.
gcc -v: gcc version 4.2.1 (SUSE Linux)
ld -v: GNU ld (GNU Binutils) 2.17.50.20070726-14 (SUSE Linux)


I get the following error:
--------------------------8<-----------------------------------
ld: memtest_shared: could not find output section .gnu.hash
ld: final link failed: Nonrepresentable section on output
make: *** [memtest_shared] Error 1
--------------------------8<-----------------------------------

I found a hint on the web that the entry
--------------------------8<-----------------------------------
.gnu.hash : { *(.gnu.hash) }
--------------------------8<-----------------------------------
is missing in the file 'memtest_shared.lds'.
As soon as I put this line in that file beneath the line
.hash : { *(.hash) }
I can link the resulting binary.

I don't know who's responsible for that issue, but probably you're interested.

Best regards
Andreas


Memtest86+ does NOT compile on GCC4.2 nor 4.3. You must use 4.1 instead. That's a known issue and you can check the announcement about that.


Citation:
Envoyé par Doc TB Voir le message
Memtest86+ does NOT compile on GCC4.2 nor 4.3. You must use 4.1 instead. That's a known issue and you can check the announcement about that.
Uuuppps, then I know who's responsible: Me! Not reading the announcement.

Sorry for bothering.

Best regards
Andreas
=========================================================================

=========================================================================

=========================================================================

阅读(2152) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~