Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Linker problem with C Code on AIX

Status
Not open for further replies.

ronenhm

Programmer
Dec 20, 2001
43
IL
Hi
i have a simple C HelloWorld program the code is:
//--------------------------------------------------------
#include<stdio.h>
void main(void)
{
printf(&quot;Hello&quot;);
}
//--------------------------------------------------------
i compiled it using Script:
echo
echo &quot;--------------------------------------&quot;
echo 'Compiling' $1.c
echo
rm $1.o
cc -I. -I/usr/sybase/OCS-12_0/include -qmaxmem=8192 -O -c $1.c
//--------------------------------------------------------
When i try to link using this script i get an error:
echo 'linking '$1'.o -lcurses active'

cc $1.o $OBJ -lcurses -lm -O -o $1

OUTPUT:
linking Hello.o -lcurses active
ld: 0711-317 ERROR: Undefined symbol: .__C_runtime_startup
ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.
//--------------------------------------------------------


what am i doing wrong?
thanks ronen.

 
I'm a little unclear as to the steps you are taking but
I first need to ask... can you compile and link from the command line?

For example: cc -o hello hello.c

This will just do the default lookups for libs and headers.
Are you getting an error when you add &quot;-l curses&quot;?
 
Hi,

thanks for taking the time to unswer
when i Run this line:

# cc -o hello hello.c

i get this error:
ld: 0711-317 ERROR: Undefined symbol: .__C_runtime_startup
ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information

Ronen.
 
Unfortunately I don't have access to an AIX system right now
but how about trying what the error message recommends...

cc -bnoquiet -o hello hello.c

Let's see what &quot;additional information&quot; it will gleen.
It's acting like something is not set up properly.
Also, can you tell me the version of AIX and the
compiler (I assume it's IBM's xlc compiler)?
 
The symbol __C_runtime_startup should be defined in your C++ runtime library (wherever /usr/lib/libC.a points), which should have been installed with the compiler. You should check to see whether or not this exists, or is a link to a valid library.

Also, the compiler is probably using a file called /etc/vac.cfg to build its actual compile and link commands - there could be a problem with this file somehow. You might use the -v option on the compiler to get more information about what kind of link line is getting constructed.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top