setenv function in C programming

Hi

I have a problem with setenv function in C. I'm calling an .exe of a c program from my shell script. Now, I have to pass a value from the .exe to my shell script. So i have exported an variable in my script. And in the C program I'm setting the variable as

setenv("REC_CNT",rec_cnt,1);

where rec_cnt is the string pointer variable. REC_CNT is the shell variable I'm exporting. But when I compile my C program, I'm getting the following error.

/usr/ccs/bin/ld: Unsatisfied symbols:
setenv (first referenced in sample.o) (code)

Can someone help me with this ?

Thanks,
Jane A

setenv is defined in stdlib.h - this means it is part of libc, which is brought in by default.

Are you sure there are no goofy or extra characters in "setenv" in the text of the code?

cc sample.c -o sample

is the command you used, correct?

Nope ! There are no extra characters in the function.
Mine is a Pro C file. I compiled it using Makefile.

What OS are you using? Your makefile may have an error. Compile the program without using make.

I am working in Unix Environment. Can you please tell me how to compile a Pro C file without a make ?

"Unix environment" does not tell us what OS you are using. Run the command "uname -a" and post the results. I don't know what "Pro C" is supposed to mean. The command that Jim gave is how you compile a C program.

cc sample.c -o sample

I am using HP-UX B.11.11. With Pro C I mean Pro* C.

Very basic compile

proc tmp.pc 
cc tmp.c -o tmp -L $ORACLE_HOME/lib32 -lclntsh

It looks to me like you've copied sample code from soemwhere and are trying to compile it.