LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-21-2005, 09:32 PM   #1
jiapei100
Member
 
Registered: Jan 2005
Location: Surrey, BC, Canada
Distribution: Ubuntu 12.04
Posts: 70

Rep: Reputation: 15
how to program with NETPBM?


I did a simple program in KDevelop like this:

1.

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

#include <iostream>
#include <cstdlib>
#include "pbm.h"

using namespace std;

int main( int argc, char** argv )
{
pbm_init(NULL, NULL);
bit **bits = NULL;
bits = pbm_allocarray(640,480);

}

2.
Add "/usr/include" to my include directory, which contains pbm.h ( I think this directory contains every head files after I install netpbm-10.25.rpm)

3.
Add "-lnetpbm" as my dynamic library, which I thought is the only

4.
Compile, pass. Success

5.
Build! Wrong!!! Obviously, Link Error. Is there anybody who can just tell me what else I'm short of?? I'm sure that those 2 functions `pbm_init(int*, char**)' and `pm_allocarray(int, int, int)' should be in the library netpbm. Besides, I tried the static library libnetpbm.a as well. the same error.. Any other libraries I need???

cd '/home/pjia/programs/netpbm_test/debug' && WANT_AUTOCONF_2_5="1" WANT_AUTOMAKE_1_6="1" gmake -k
gmake all-recursive
Making all in src
/bin/sh ../libtool --mode=link --tag=CXX g++ -O0 -g3 -o netpbm_test netpbm_test.o -lnetpbm
g++ -O0 -g3 -o netpbm_test netpbm_test.o -lnetpbm
netpbm_test.o(.text+0x120): In function `main':
/home/pjia/programs/netpbm_test/src/netpbm_test.cpp:36: undefined reference to `pbm_init(int*, char**)'
netpbm_test.o(.text+0x13e):/home/pjia/programs/netpbm_test/src/netpbm_test.cpp:38: undefined reference to `pm_allocarray(int, int, int)'
collect2: ld returned 1 exit status
gmake[2]: *** [netpbm_test] Error 1
gmake[2]: Target `all' not remade because of errors.
gmake[1]: *** [all-recursive] Error 1
gmake: *** [all] Error 2
*** Exited with status: 2 ***


Thank you very much

Last edited by jiapei100; 03-22-2005 at 12:29 AM.
 
Old 03-22-2005, 03:10 PM   #2
TheLinuxDuck
Member
 
Registered: Sep 2002
Location: Tulsa, OK
Distribution: Slack, baby!
Posts: 349

Rep: Reputation: 33
Two things:

My system is calling the pbm library libpbm.so, not libnetpbm.so. Also, my libpbm.so called the allocarray function pm_allocarray, not pbm_allocarray.

Try those, instead.
 
Old 03-22-2005, 06:33 PM   #3
jiapei100
Member
 
Registered: Jan 2005
Location: Surrey, BC, Canada
Distribution: Ubuntu 12.04
Posts: 70

Original Poster
Rep: Reputation: 15
Yes, I will try that. But when I did the following command line

$ nm -C /usr/local/netpbm/lib/libnetpbm.a | grep "pm_allocarray"
0000043c T pm_allocarray
U pm_allocarray
U pm_allocarray
U pm_allocarray
U pm_allocarray
U pm_allocarray

$ nm -C /usr/local/netpbm/lib/libnetpbm.a | grep "pm_init"
00000000 T pbm_init
U pbm_init


U means undefined, T means contained...

Why it alwasy tell T and U at the same time? I will try netpbm 9.0...
But, in my opnion, netpbm 10.0 does work, but I don't know how to let it work correctly...

Anyway, thank you very much...
 
  


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
Total recovery: Which program? ghost4linux, YaST2? Best drive imaging program? lagu2653 Linux - Software 1 06-20-2005 01:44 PM
netpbm install help tommytomato Linux - Newbie 2 10-27-2004 08:47 PM
NetPbm path on fedora Drogo Linux - Software 0 01-31-2004 01:21 PM
Gtk-Warning but program still works... I close konsole, program closes Laptop2250 Linux - Software 2 11-14-2003 11:18 PM
Installing NetPBM RPM via SSH gregoryfrancis Linux - Software 5 03-03-2003 01:39 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

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