LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 09-17-2003, 03:30 PM   #1
trinitor
LQ Newbie
 
Registered: Sep 2003
Posts: 5

Rep: Reputation: 0
Question Problems compiling bwbar


I have downloaded the file bwbar-1.2.tar.gz from kernel.org, but when I type make i comes up with an error and it fails to compile..

And the problem is: I really have no clue whatsoever on whats wrong.. Can anyone please help?

I am running:
Rehat 9
gcc 3.2.2

Here is the output:

[root@trinisrv bwbar-1.2]# make
gcc -Wall -O2 -s -o bwbar bwbar.c -lpng
bwbar.c:32:17: png.h: No such file or directory
bwbar.c: In function `write_bar_graph':
bwbar.c:44: syntax error before "palette"
bwbar.c: At top level:
bwbar.c:56: parse error before "png_ptr"
bwbar.c:56: warning: type defaults to `int' in declaration of `png_ptr'
bwbar.c:56: warning: initialization makes integer from pointer without a cast
bwbar.c:56: warning: data definition has no type or storage class
bwbar.c:57: parse error before "info_ptr"
bwbar.c:57: warning: type defaults to `int' in declaration of `info_ptr'
bwbar.c:57: warning: initialization makes integer from pointer without a cast
bwbar.c:57: warning: data definition has no type or storage class
bwbar.c:58: parse error before '*' token
bwbar.c:58: warning: type defaults to `int' in declaration of `border_row'
bwbar.c:58: warning: data definition has no type or storage class
bwbar.c:59: parse error before '*' token
bwbar.c:59: warning: type defaults to `int' in declaration of `bar_row'
bwbar.c:59: warning: data definition has no type or storage class
bwbar.c:60: parse error before '*' token
bwbar.c:60: warning: type defaults to `int' in declaration of `bp'
bwbar.c:60: warning: data definition has no type or storage class
bwbar.c:63: warning: type defaults to `int' in declaration of `bwidth'
bwbar.c:63: `width' undeclared here (not in a function)
bwbar.c:63: `border' undeclared here (not in a function)
bwbar.c:63: warning: data definition has no type or storage class
bwbar.c:64: warning: type defaults to `int' in declaration of `bheight'
bwbar.c:64: `height' undeclared here (not in a function)
bwbar.c:64: `border' undeclared here (not in a function)
bwbar.c:64: warning: data definition has no type or storage class
bwbar.c:66: warning: type defaults to `int' in declaration of `border_row'
bwbar.c:66: conflicting types for `border_row'
bwbar.c:58: previous declaration of `border_row'
bwbar.c:66: `png_byte' undeclared here (not in a function)
bwbar.c:66: warning: data definition has no type or storage class
bwbar.c:67: warning: type defaults to `int' in declaration of `bar_row'
bwbar.c:67: conflicting types for `bar_row'
bwbar.c:59: previous declaration of `bar_row'
bwbar.c:67: `png_byte' undeclared here (not in a function)
bwbar.c:67: warning: data definition has no type or storage class
bwbar.c:69: parse error before "if"
bwbar.c:72: warning: type defaults to `int' in declaration of `png_ptr'
bwbar.c:72: redefinition of `png_ptr'
bwbar.c:56: `png_ptr' previously defined here
bwbar.c:72: warning: implicit declaration of function `png_create_write_struct'
bwbar.c:72: `PNG_LIBPNG_VER_STRING' undeclared here (not in a function)
bwbar.c:73: initializer element is not constant
bwbar.c:73: warning: data definition has no type or storage class
bwbar.c:75: parse error before "if"
bwbar.c:78: warning: type defaults to `int' in declaration of `info_ptr'
bwbar.c:78: redefinition of `info_ptr'
bwbar.c:57: `info_ptr' previously defined here
bwbar.c:78: warning: implicit declaration of function `png_create_info_struct'
bwbar.c:78: initializer element is not constant
bwbar.c:78: warning: data definition has no type or storage class
bwbar.c:79: parse error before "if"
bwbar.c:87: warning: type defaults to `int' in declaration of `png_init_io'
bwbar.c:87: warning: parameter names (without types) in function declaration
bwbar.c:87: warning: data definition has no type or storage class
bwbar.c:89: warning: type defaults to `int' in declaration of `png_set_compression_level'
bwbar.c:89: warning: parameter names (without types) in function declaration
bwbar.c:89: warning: data definition has no type or storage class
bwbar.c:92: parse error before numeric constant
bwbar.c:94: warning: type defaults to `int' in declaration of `png_set_IHDR'
bwbar.c:94: warning: data definition has no type or storage class
bwbar.c:96: parse error before numeric constant
bwbar.c:96: warning: type defaults to `int' in declaration of `png_set_PLTE'
bwbar.c:96: warning: data definition has no type or storage class
bwbar.c:98: warning: type defaults to `int' in declaration of `png_write_info'
bwbar.c:98: warning: parameter names (without types) in function declaration
bwbar.c:98: warning: data definition has no type or storage class
bwbar.c:100: warning: type defaults to `int' in declaration of `png_set_packing'
bwbar.c:100: warning: parameter names (without types) in function declaration
bwbar.c:100: warning: data definition has no type or storage class
bwbar.c:105: parse error before "__extension__"
bwbar.c:105: parse error before "__uint8_t"
bwbar.c:105: warning: type defaults to `int' in declaration of `__s'
bwbar.c:105: warning: data definition has no type or storage class
bwbar.c:105: parse error before '}' token
bwbar.c:105: warning: initialization makes pointer from integer without a cast
bwbar.c:105: initializer element is not constant
bwbar.c:105: parse error before "switch"
bwbar.c:105: warning: type defaults to `int' in declaration of `__u'
bwbar.c:105: conflicting types for `__u'
bwbar.c:105: previous declaration of `__u'
bwbar.c:105: warning: data definition has no type or storage class
bwbar.c:105: parse error before "case"
bwbar.c:105: warning: type defaults to `int' in declaration of `__u'
bwbar.c:105: warning: initialization makes integer from pointer without a cast
bwbar.c:105: initializer element is not constant
bwbar.c:105: warning: data definition has no type or storage class
bwbar.c:105: parse error before "case"
bwbar.c:105: warning: type defaults to `int' in declaration of `__u'
bwbar.c:105: redefinition of `__u'
bwbar.c:105: `__u' previously defined here
bwbar.c:105: warning: initialization makes integer from pointer without a cast
bwbar.c:105: initializer element is not constant
bwbar.c:105: warning: data definition has no type or storage class
bwbar.c:105: parse error before "case"
bwbar.c:105: warning: type defaults to `int' in declaration of `__u'
bwbar.c:105: redefinition of `__u'
bwbar.c:105: `__u' previously defined here
bwbar.c:105: warning: initialization makes integer from pointer without a cast
bwbar.c:105: initializer element is not constant
bwbar.c:105: warning: data definition has no type or storage class
bwbar.c:105: parse error before '->' token
bwbar.c:105: warning: type defaults to `int' in declaration of `__u'
bwbar.c:105: redefinition of `__u'
bwbar.c:105: `__u' previously defined here
bwbar.c:105: warning: initialization makes integer from pointer without a cast
bwbar.c:105: initializer element is not constant
bwbar.c:105: warning: data definition has no type or storage class
bwbar.c:105: parse error before "case"
bwbar.c:105: warning: type defaults to `int' in declaration of `__u'
bwbar.c:105: redefinition of `__u'
bwbar.c:105: `__u' previously defined here
bwbar.c:105: warning: initialization makes integer from pointer without a cast
bwbar.c:105: initializer element is not constant
bwbar.c:105: warning: data definition has no type or storage class
bwbar.c:105: parse error before "case"
bwbar.c:105: warning: type defaults to `int' in declaration of `__u'
bwbar.c:105: redefinition of `__u'
bwbar.c:105: `__u' previously defined here
bwbar.c:105: warning: initialization makes integer from pointer without a cast
bwbar.c:105: initializer element is not constant
bwbar.c:105: warning: data definition has no type or storage class
bwbar.c:105: parse error before "case"
bwbar.c:105: warning: type defaults to `int' in declaration of `__u'
bwbar.c:105: redefinition of `__u'
bwbar.c:105: `__u' previously defined here
bwbar.c:105: warning: initialization makes integer from pointer without a cast
bwbar.c:105: initializer element is not constant
bwbar.c:105: warning: data definition has no type or storage class
bwbar.c:105: parse error before "case"
bwbar.c:105: warning: type defaults to `int' in declaration of `__u'
bwbar.c:105: redefinition of `__u'
bwbar.c:105: `__u' previously defined here
bwbar.c:105: warning: initialization makes integer from pointer without a cast
bwbar.c:105: initializer element is not constant
bwbar.c:105: warning: data definition has no type or storage class
bwbar.c:105: parse error before "case"
bwbar.c:105: warning: type defaults to `int' in declaration of `__u'
bwbar.c:105: redefinition of `__u'
bwbar.c:105: `__u' previously defined here
bwbar.c:105: warning: initialization makes integer from pointer without a cast
bwbar.c:105: initializer element is not constant
bwbar.c:105: warning: data definition has no type or storage class
bwbar.c:105: parse error before "case"
bwbar.c:105: warning: type defaults to `int' in declaration of `__u'
bwbar.c:105: redefinition of `__u'
bwbar.c:105: `__u' previously defined here
bwbar.c:105: warning: initialization makes integer from pointer without a cast
bwbar.c:105: initializer element is not constant
bwbar.c:105: warning: data definition has no type or storage class
bwbar.c:105: parse error before "case"
bwbar.c:105: warning: type defaults to `int' in declaration of `__u'
bwbar.c:105: redefinition of `__u'
bwbar.c:105: `__u' previously defined here
bwbar.c:105: warning: initialization makes integer from pointer without a cast
bwbar.c:105: initializer element is not constant
bwbar.c:105: warning: data definition has no type or storage class
bwbar.c:105: parse error before "case"
bwbar.c:105: warning: type defaults to `int' in declaration of `__u'
bwbar.c:105: redefinition of `__u'
bwbar.c:105: `__u' previously defined here
bwbar.c:105: warning: initialization makes integer from pointer without a cast
bwbar.c:105: initializer element is not constant
bwbar.c:105: warning: data definition has no type or storage class
bwbar.c:105: parse error before "case"
bwbar.c:105: warning: type defaults to `int' in declaration of `__s'
bwbar.c:105: warning: data definition has no type or storage class
bwbar.c:105: parse error before '}' token
bwbar.c:105: parse error before '\x0'
bwbar.c:105: warning: type defaults to `int' in declaration of `__builtin_memset'
bwbar.c:105: warning: data definition has no type or storage class
bwbar.c:105: warning: type defaults to `int' in declaration of `__s'
bwbar.c:105: warning: data definition has no type or storage class
bwbar.c:105: parse error before '}' token
bwbar.c:108: warning: type defaults to `int' in declaration of `bp'
bwbar.c:108: conflicting types for `bp'
bwbar.c:60: previous declaration of `bp'
bwbar.c:108: warning: data definition has no type or storage class
bwbar.c:109: parse error before "for"
bwbar.c:112: warning: type defaults to `int' in declaration of `spacer'
bwbar.c:112: warning: data definition has no type or storage class
bwbar.c:113: parse error before "for"
bwbar.c:115: warning: type defaults to `int' in declaration of `fspacer'
bwbar.c:115: `spacers' undeclared here (not in a function)
bwbar.c:115: warning: data definition has no type or storage class
bwbar.c:116: parse error before "if"
bwbar.c:123: parse error before '++' token
bwbar.c:124: warning: type defaults to `int' in declaration of `spacer'
bwbar.c:124: redefinition of `spacer'
bwbar.c:112: `spacer' previously defined here
bwbar.c:124: initializer element is not constant
bwbar.c:124: warning: data definition has no type or storage class
bwbar.c:125: parse error before '}' token
bwbar.c:139: warning: type defaults to `int' in declaration of `png_write_end'
bwbar.c:139: warning: parameter names (without types) in function declaration
bwbar.c:139: warning: data definition has no type or storage class
bwbar.c:140: warning: type defaults to `int' in declaration of `status'
bwbar.c:140: redefinition of `status'
bwbar.c:61: `status' previously defined here
bwbar.c:140: warning: data definition has no type or storage class
bwbar.c:142: parse error before ':' token
make: *** [bwbar] Error 1
 
Old 09-17-2003, 06:26 PM   #2
teval
Member
 
Registered: Jul 2003
Location: Toronto, Canada
Distribution: Gentoo
Posts: 720

Rep: Reputation: 30
Frequently in C/C++ and many other langues only the first error matters much.
Everything else is a result of that, in this case that holds true.

bwbar.c:32:17: png.h: No such file or directory

You need to install libpng

http://www.libpng.org/pub/png/libpng.html
 
Old 09-18-2003, 02:38 AM   #3
trinitor
LQ Newbie
 
Registered: Sep 2003
Posts: 5

Original Poster
Rep: Reputation: 0
Hmm.. When i do a rpm -qa | grep png, libpng seems to be installed..

[root@trinisrv root]# rpm -qa | grep png
libpng-1.2.2-16
libpng10-1.0.13-8

Any suggentions?
 
Old 09-18-2003, 09:14 PM   #4
teval
Member
 
Registered: Jul 2003
Location: Toronto, Canada
Distribution: Gentoo
Posts: 720

Rep: Reputation: 30
Try changing the makefile
gcc -Wall -O2 -s -o bwbar bwbar.c -lpng

Add -I/usr/include -I/usr/local/include
To form:

gcc -Wall -I/usr/include -I/usr/local/include -O2 -s -o bwbar bwbar.c -lpng

That might work.
 
Old 09-21-2003, 08:25 AM   #5
trinitor
LQ Newbie
 
Registered: Sep 2003
Posts: 5

Original Poster
Rep: Reputation: 0
Now I have update the libpng rpm to 1.2.2-16 and it outputs the following:


[root@trinisrv bwbar-1.2]# make
gcc -Wall -O2 -s -o bwbar bwbar.c -lpng
/usr/local/lib/libpng.so: undefined reference to `deflate'
/usr/local/lib/libpng.so: undefined reference to `inflate'
/usr/local/lib/libpng.so: undefined reference to `inflateInit_'
/usr/local/lib/libpng.so: undefined reference to `crc32'
/usr/local/lib/libpng.so: undefined reference to `pow'
/usr/local/lib/libpng.so: undefined reference to `deflateInit2_'
/usr/local/lib/libpng.so: undefined reference to `inflateReset'
/usr/local/lib/libpng.so: undefined reference to `deflateReset'
/usr/local/lib/libpng.so: undefined reference to `inflateEnd'
/usr/local/lib/libpng.so: undefined reference to `deflateEnd'
collect2: ld returned 1 exit status
make: *** [bwbar] Error 1

BTW, I tried chaning the makefile, but it doesn't make any difference at all.. Still the same output as above..
 
Old 09-21-2003, 10:21 AM   #6
teval
Member
 
Registered: Jul 2003
Location: Toronto, Canada
Distribution: Gentoo
Posts: 720

Rep: Reputation: 30
Instead of -lpng use:

-L/usr/lib -Wl,-rpath,/usr/lib -lpng12 -lz -lm

How I got to this is:

libpng-config --ldflags

You can alternativly use:

`libpng-config --ldflags` instead of -lpng12
When I'm too lazy to write a configure and I just make a makefile I use this. It executes the program and uses it's output. Note the ` encasing it.

Many many if not most libraries of this sort have this kind of program.
ls /usr/bin |grep config
To get a list of them, or just use the tab autocomplete to find them.
Seems that you don't need the cflags but for future refenrece you'd need

libpng-config --cflags and libpng-config --ldflags

The former is used when generating object files, .o files, that's the kind of error you had in the first place. The latter is for linking the kind of error you have now.

Last edited by teval; 09-21-2003 at 10:24 AM.
 
Old 09-21-2003, 02:30 PM   #7
trinitor
LQ Newbie
 
Registered: Sep 2003
Posts: 5

Original Poster
Rep: Reputation: 0
Wee! It works!

Thanks for the help.. Next time you visit Denmark come by and I'll buy you a beer! Or two.. ;D
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
problems compiling alaios Linux - General 3 02-10-2005 06:00 AM
Problems Compiling Problems With GCC And C++ phnxbn Linux - Software 0 11-02-2004 05:49 PM
Problems installing amsn (TK compiling problems) JNewton Linux - Software 0 05-24-2004 12:07 PM
Compiling Problems natesch Linux - General 1 05-09-2002 12:30 AM
compiling problems cameronknives Linux - General 31 02-10-2002 09:56 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

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