Comment out this line:
strerror is defined in string.h so your declaration is redundant. I'm guessing it must have been needed on some other system that didn't declare it in string.h, so if you want to be really thorough, you could do something like:
Including string.h more than once shouldn't hurt because it has start and end code like this:
If I comment out this what I will get in error
couliba@linux:~/bin/GaSource> make find_rules
cc find_rules.c -o find_rules
/tmp/ccsfOXjS.o(.text+0x72): In function `main':
find_rules.c: undefined reference to `seed'
/tmp/ccsfOXjS.o(.text+0x18e):find_rules.c: undefined reference to `print_help_message'
/tmp/ccsfOXjS.o(.text+0x23d):find_rules.c: undefined reference to `read_cline'
/tmp/ccsfOXjS.o(.text+0x679):find_rules.c: undefined reference to `define_type'
/tmp/ccsfOXjS.o(.text+0x68c):find_rules.c: undefined reference to `define_type'
/tmp/ccsfOXjS.o(.text+0x69f):find_rules.c: undefined reference to `define_type'
/tmp/ccsfOXjS.o(.text+0x6e5):find_rules.c: undefined reference to `define_function'
/tmp/ccsfOXjS.o(.text+0x702):find_rules.c: undefined reference to `define_tree'
/tmp/ccsfOXjS.o(.text+0x789):find_rules.c: undefined reference to `init_data'
/tmp/ccsfOXjS.o(.text+0x821):find_rules.c: undefined reference to `read_data'
/tmp/ccsfOXjS.o(.text+0x850):find_rules.c: undefined reference to `normalize_price'
/tmp/ccsfOXjS.o(.text+0xe30):find_rules.c: undefined reference to `compounded_return'
/tmp/ccsfOXjS.o(.text+0xe61):find_rules.c: undefined reference to `compounded_return'
/tmp/ccsfOXjS.o(.text+0xf30):find_rules.c: undefined reference to `new_tree'
/tmp/ccsfOXjS.o(.text+0x10fa):find_rules.c: undefined reference to `create_population'
/tmp/ccsfOXjS.o(.text+0x1151):find_rules.c: undefined reference to `create_offspring'
/tmp/ccsfOXjS.o(.text+0x11da):find_rules.c: undefined reference to `eval_genome'
/tmp/ccsfOXjS.o(.text+0x1210):find_rules.c: undefined reference to `compute_return'
/tmp/ccsfOXjS.o(.text+0x123f):find_rules.c: undefined reference to `compounded_return'
/tmp/ccsfOXjS.o(.text+0x12a1):find_rules.c: undefined reference to `compute_statistics'
/tmp/ccsfOXjS.o(.text+0x12b8):find_rules.c: undefined reference to `cluster_population'
/tmp/ccsfOXjS.o(.text+0x14cf):find_rules.c: undefined reference to `eval_genome'
/tmp/ccsfOXjS.o(.text+0x1505):find_rules.c: undefined reference to `compute_return'
/tmp/ccsfOXjS.o(.text+0x1534):find_rules.c: undefined reference to `compounded_return'
/tmp/ccsfOXjS.o(.text+0x17ce):find_rules.c: undefined reference to `copy_genome'
/tmp/ccsfOXjS.o(.text+0x1b79):find_rules.c: undefined reference to `save_genome'
/tmp/ccsfOXjS.o(.text+0x1c24):find_rules.c: undefined reference to `eval_genome'
/tmp/ccsfOXjS.o(.text+0x1c5e):find_rules.c: undefined reference to `compute_return'
/tmp/ccsfOXjS.o(.text+0x1c91):find_rules.c: undefined reference to `compounded_return'
/tmp/ccsfOXjS.o(.text+0x1d9f):find_rules.c: undefined reference to `dispose_population'
/tmp/ccsfOXjS.o(.text+0x1de3):find_rules.c: undefined reference to `descending_order'
/tmp/ccsfOXjS.o(.text+0x1dfc):find_rules.c: undefined reference to `order_by_key'
/tmp/ccsfOXjS.o(.data+0x50): undefined reference to `print_boolean'
/tmp/ccsfOXjS.o(.data+0x54): undefined reference to `eval_if_then'
/tmp/ccsfOXjS.o(.data+0xa0): undefined reference to `print_boolean'
/tmp/ccsfOXjS.o(.data+0xa4): undefined reference to `eval_if_then_else'
/tmp/ccsfOXjS.o(.data+0xf0): undefined reference to `print_boolean'
/tmp/ccsfOXjS.o(.data+0xf4): undefined reference to `eval_and'
/tmp/ccsfOXjS.o(.data+0x140): undefined reference to `print_boolean'
/tmp/ccsfOXjS.o(.data+0x144): undefined reference to `eval_or'
/tmp/ccsfOXjS.o(.data+0x190): undefined reference to `print_boolean'
/tmp/ccsfOXjS.o(.data+0x194): undefined reference to `eval_not'
/tmp/ccsfOXjS.o(.data+0x1e0): undefined reference to `print_boolean'
/tmp/ccsfOXjS.o(.data+0x1e4): undefined reference to `eval_greater'
/tmp/ccsfOXjS.o(.data+0x230): undefined reference to `print_boolean'
/tmp/ccsfOXjS.o(.data+0x234): undefined reference to `eval_less'
/tmp/ccsfOXjS.o(.data+0x278): undefined reference to `init_boolean'
/tmp/ccsfOXjS.o(.data+0x27c): undefined reference to `read_boolean'
/tmp/ccsfOXjS.o(.data+0x280): undefined reference to `print_boolean'
/tmp/ccsfOXjS.o(.data+0x2d4): undefined reference to `eval_flip'
/tmp/ccsfOXjS.o(.data+0x320): undefined reference to `print_real'
/tmp/ccsfOXjS.o(.data+0x324): undefined reference to `eval_plus'
/tmp/ccsfOXjS.o(.data+0x370): undefined reference to `print_real'
/tmp/ccsfOXjS.o(.data+0x374): undefined reference to `eval_minus'
/tmp/ccsfOXjS.o(.data+0x3c0): undefined reference to `print_real'
/tmp/ccsfOXjS.o(.data+0x3c4): undefined reference to `eval_multiply'
/tmp/ccsfOXjS.o(.data+0x410): undefined reference to `print_real'
/tmp/ccsfOXjS.o(.data+0x414): undefined reference to `eval_divide'
/tmp/ccsfOXjS.o(.data+0x460): undefined reference to `print_real'
/tmp/ccsfOXjS.o(.data+0x464): undefined reference to `eval_negation'
/tmp/ccsfOXjS.o(.data+0x4b0): undefined reference to `print_real'
/tmp/ccsfOXjS.o(.data+0x4b4): undefined reference to `eval_norm'
/tmp/ccsfOXjS.o(.data+0x500): undefined reference to `print_real'
/tmp/ccsfOXjS.o(.data+0x504): undefined reference to `eval_average'
/tmp/ccsfOXjS.o(.data+0x550): undefined reference to `print_real'
/tmp/ccsfOXjS.o(.data+0x554): undefined reference to `eval_maximum'
/tmp/ccsfOXjS.o(.data+0x5a0): undefined reference to `print_real'
/tmp/ccsfOXjS.o(.data+0x5a4): undefined reference to `eval_minimum'
/tmp/ccsfOXjS.o(.data+0x5f0): undefined reference to `print_real'
/tmp/ccsfOXjS.o(.data+0x5f4): undefined reference to `eval_slope'
/tmp/ccsfOXjS.o(.data+0x640): undefined reference to `print_real'
/tmp/ccsfOXjS.o(.data+0x644): undefined reference to `eval_volatility'
/tmp/ccsfOXjS.o(.data+0x690): undefined reference to `print_real'
/tmp/ccsfOXjS.o(.data+0x694): undefined reference to `eval_lag'
/tmp/ccsfOXjS.o(.data+0x6e0): undefined reference to `print_real'
/tmp/ccsfOXjS.o(.data+0x6e4): undefined reference to `eval_data'
/tmp/ccsfOXjS.o(.data+0x728): undefined reference to `init_real'
/tmp/ccsfOXjS.o(.data+0x72c): undefined reference to `read_real'
/tmp/ccsfOXjS.o(.data+0x730): undefined reference to `print_real'
/tmp/ccsfOXjS.o(.data+0x784): undefined reference to `eval_price'
/tmp/ccsfOXjS.o(.data+0x7d4): undefined reference to `eval_compounded'
collect2: ld returned 1 exit status
make: *** [find_rules] Error 1
/*------------------------------------------------------------------------------
'get_boolean' prints '*prompt' and reads a character from stdin. 'answers'
contains the valid character set. If the entered character equals 'affirm',
'def' is returned.
------------------------------------------------------------------------------*/
extern int get_boolean(char *prompt, char *answers, int def, char affirm);
/*------------------------------------------------------------------------------
'get_int' prints '*prompt' and reads an integer from stdin. The entered
integer must be in the range 'min' .. 'max'. If none is entered, 'def'
is returned, instead.
*/
I will receive this error
ouliba@linux:~/bin/GaSource> make find_rules
cc find_rules.c -o find_rules
In file included from find_rules.c:19:
util.h:17: error: conflicting types for `strerror'
/usr/include/string.h:256: error: previous declaration of `strerror'
find_rules.c: In function `main':
find_rules.c:203: warning: passing arg 1 of `strerror' makes pointer from integer without a cast
find_rules.c:248: warning: passing arg 1 of `strerror' makes pointer from integer without a cast
find_rules.c:315: warning: passing arg 1 of `strerror' makes pointer from integer without a cast
make: *** [find_rules] Error 1
couliba@linux:~/bin/GaSource>
Any more advise, I appreciate so much
Quote:
Originally Posted by Corona688
Comment out this line:
strerror is defined in string.h so your declaration is redundant. I'm guessing it must have been needed on some other system that didn't declare it in string.h, so if you want to be really thorough, you could do something like:
Including string.h more than once shouldn't hurt because it has start and end code like this:
That error is what Corona is trying to help you with - you have strerror declared in util.h. Put the #ifndef and #define statement he gave you around the place where you encounter the error in util.h.
To find where strerror is doubly defined try this:
You will see something like "extern char *strerror" appearing twice. It should show up only once.
Those errors are exactly what it says they are. It cannot find those functions. You probably need to compile another file to get them. Not all C files are standalone. The general sequence is:
In a makefile you might have something like:
It should already understand how to convert .c to .o, so you just tell it how to convert those .o's to one executable. LDFLAGS is an optional variable that might comtain library flags.
And please, for the love of yog, put your code in code-tags!!
Last edited by Corona688; 07-07-2006 at 11:26 AM..
Those errors are exactly what it says they are. It cannot find those functions. You probably need to compile another file to get them. Not all C files are standalone. The general sequence is:
In a makefile you might have something like:
It should already understand how to convert .c to .o, so you just tell it how to convert those .o's to one executable. LDFLAGS is an optional variable that might comtain library flags.
And please, for the love of yog, put your code in code-tags!!
Your advice may be a solution to my problem, but I am not sure if I understand what you want me to do. Can you please put in away I can understand.
As you said. it can not find those function. that is right but how do I make it to find those function.
In a directory by itself, create this file:
Then compile and run it like this:
That works, but what you might not realize is that gcc is actually doing two steps, not one -- compilation, then linking. The compilation stage converts C code into assembly language, the linking stage ties everything together into an executable. Let's break it into two steps:
That's what gcc is ACTUALLY doing... converts the C file into an object file(.o), then links the object file into an executable.
Now let's try and use a function from another .c file. First, create this file:
Then, modify main.c to use it like this:
Finally, let's see what happens when we try and compile it, then link it:
It doesn't work. It compiles it fine since there's no syntax errors in the program, but the function it wants is not in main.o! To get that function, we'll need to give it library.o too.
It works!
Now, if you want your makefile to do that, you need to tell it that the output file needs main.o and library.o. Here's a simple makefile:
With that makefile in the main directory, let's try it:
It works!
So there you go. You'll need to find the .c file that these missing functions reside in, convert it to an object, then link it into your executable.
Last edited by Corona688; 07-11-2006 at 11:25 AM..
Reason: mistake in examples
I am writing a shell script with 2 run time arguments. During the execution if i got any error, then it needs to redirected to a error file and in console. Also both error and output to be redirected to a log file. But i am facing the below error.
#! /bin/sh
errExit ()
{
errMsg=`cat... (1 Reply)
I have two servers with a fresh install of Solaris 11, and having problems when doing rpcinfo between them. There is no firewall involved, so everything should theoretically be getting through. Does anyone have any ideas? I did a lot of Google searches, and haven't found a working solution yet.
... (2 Replies)
what is this error log = hda: irq timeout: error=0x00 and how to solve?
every day upon checking the logs i see this error.
hda: irq timeout: error=0x00
hda: irq timeout: error=0x00
hda: irq timeout: error=0x00
hda: irq timeout: error=0x00
hw_client: segfault at 0000000000000046 rip... (3 Replies)
im kinda new to shell scripting so i need some help
i try to run this script and get the error code
> 5 ")syntax error: operand expected (error token is "
the code for the script is
#!/bin/sh
#
# script to see if the given value is correct
#
# Define errors
ER_AF=86 # Var is... (4 Replies)
Hi - I am getting the error
`Error reading response length from authentication socket'
when I ssh from my cluster to another cluster, and then back to my cluster. It doesn't seem to affect anything, but it's just annoying that it always pops up and tends to confuse new users of the cluster. I... (1 Reply)
Hi Guys.
This is part of my filesystem structure :
Filesystem size used avail capacity Mounted on
/dev/md/dsk/d0 47G 5.2G 42G 12% /
/devices 0K 0K 0K 0% /devices
ctfs 0K 0K 0K 0% ... (2 Replies)
--------------------------------------------------------------------------------
Hello, help me please.
I am trying to create a mksysb bakup using nim. I am geting this error, how to correct it ? :
Command : failed stdout: yes stderr: no... (9 Replies)
I encounters a VSIFAX related error:
vfxstat: Cannot login to server on rsac3: Connect error to host 172.16.1.45: Invalid argument
It started happening last night with a core dump. Then we can't start VSIFAX again.
I am runing VSI-FAX 4.2 on AIX box (0 Replies)
hi there
i write one awk script file in shell programing
the code is related to dd/mm/yy to month, day year format
but i get an error
please can anybody help me out in this problem ??????
i give my code here including error
awk `
# date-month -- convert mm/dd/yy to month day,... (2 Replies)
Hey guys, need some help. Running AIX Version 5.2 and one of our cron jobs is writing errors to a log file. Any ideas on the following error message.
Error: Internal system error: Unable to initialize standard output file
I'm guessing more info might be needed, so let me know.
Thanks (2 Replies)