Request help to debug errors while running in 'C'


 
Thread Tools Search this Thread
Top Forums Programming Request help to debug errors while running in 'C'
# 1  
Old 07-21-2008
Request help to debug errors while running in 'C'

I run, 2 'C' Files, gapw.c and getkey.c, but I get the following errors :-

I) $ gcc gapw.c

gapw.c: In function `main':
gapw.c:96: warning: cast to pointer from integer of different size
/tmp/cck4I8mW.o(.text+0x227): In function `main':
: undefined reference to `getprofilestring'
/tmp/cck4I8mW.o(.text+0x2f6): In function `main':
: undefined reference to `getprofilestring'
collect2: ld returned 1 exit status


II) $gcc getkey.c

getkey.c: In function `main':
getkey.c:65: warning: cast to pointer from integer of different size
/tmp/ccQlGq7C.o(.text+0xea): In function `main':
: undefined reference to `getprofilestring'
/tmp/ccQlGq7C.o(.text+0x1ab): In function `main':
: undefined reference to `getallappkey'
/tmp/ccQlGq7C.o(.text+0x26c): In function `main':
: undefined reference to `getappkeys'
/tmp/ccQlGq7C.o(.text+0x321): In function `main':
: undefined reference to `getallapp'
/tmp/ccQlGq7C.o(.text+0x3f1): In function `main':
: undefined reference to `writeprofilestring'
collect2: ld returned 1 exit status


I included the following header files in my code, but still the errors are not removed :-

#include <stdlib.h>
#include <libgen.h>

I think these are some generic errors. Request you to please help me to debug the errors.

Thanks in advance.

Regards,
Marconi.
# 2  
Old 07-21-2008
Those are linker errors. I don't know much about libgen, but this answer assumes there is a libgen.* file in the /usr/lib/ directory. If it is not you will have to find it and then learn how to get gcc to see it with -L
Code:
gcc gapw.c -lgen -o gapw
# you also have a syntax error in getkey.c  warnings mean it is wrong - you should fix it.
# look at line 65 in your code.
gcc getkey.c -lgen -o getkey

I added the -o <file> part because by default the compiler creates ./a.out each time you invoke the compiler. The second invocation of gcc will write over the first compile.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Errors running perl statement

When I run this #!/bin/bash Block count: 421958912 Reserved block count: 4219589 perl -e "printf(\"%.1lf%%\n\", ($Reserved block count * 100.0 ) / $Block count);" I get these error messages. Can someone please help me? andyk_~/Downloads$ Show_Percent_Reserved_Blocks.sh... (4 Replies)
Discussion started by: drew77
4 Replies

2. Linux

Apache vhost - debug web request

Hello all, I have several vhost and not sure which vhost is serving the requests to my url http://www.mydomain.tld i have ssh access to the web server is there a way e.g curl to know exactly which vhost served the request. one of my friend suggested logs but i want to find another... (4 Replies)
Discussion started by: coolatt
4 Replies

3. Shell Programming and Scripting

Debug script already running

Hello, is it possible to debug a script that is already running "on-demand"? Somehow a command like "set -x" but once you've executed the script. And another one to disable debugging? Thank you (0 Replies)
Discussion started by: asanchez
0 Replies

4. Programming

Is there any possibility of running the PHP script in a debug mode ?

Is there any possibility of running the PHP script in a debug mode ? If so, do i have to download any package? Any free downloads available? Can anyone please guide me through? Am a newbie in PHP scripting. Thanks in Advance! (1 Reply)
Discussion started by: vidhyaS
1 Replies

5. Shell Programming and Scripting

how to debug an expect script running on a tomcat server

Hello everyone, I have a small expect script as follows; #!/usr/bin/expect -f set force_conservative 0 ;# set to 1 to force conservative mode even if ;# script wasn't run conservatively originally if {$force_conservative} { set send_slow {1 .1} proc send {ignore arg}... (1 Reply)
Discussion started by: randeel
1 Replies

6. Shell Programming and Scripting

surpressing errors while running script

I have written shell script to find out pairsuspends in our environment.But when i run the script iam getting an error for the Pair which are not active.Below are the error am getting pairvolchk -g up1012 -I11 pairvolchk : execution error. pairvolchk: Unmatched CTGID within the group Refer... (3 Replies)
Discussion started by: zeebala1981
3 Replies

7. AIX

Running Installp in debug mode

Is there a way I can execute an installp command in debug mode, so that I can see whats happening when a fileset is being installed or updated? (What files are being replace etc etc). I have an installp command failing for unknown reason. (7 Replies)
Discussion started by: balaji_prk
7 Replies

8. Post Here to Contact Site Administrators and Moderators

Database Errors - Post Info Here to Help Debug - Thanks

Please post the 'Style" you are using and what activity you were doing if have received any database error recently. I'm not getting any errors, but they are in the log files. Thanks, Neo (0 Replies)
Discussion started by: Neo
0 Replies

9. UNIX for Dummies Questions & Answers

errors when running a cron job

I am running some shell scripts through a foll cron job, the script works fine and there are no errors in the log file but I receive the following error in mail for the jobs: stty: no such device or address What does the above error indicate, here is the cron job: 0 22 * * 0... (2 Replies)
Discussion started by: knarayan
2 Replies
Login or Register to Ask a Question