Archived

This topic is now archived and is closed to further replies.

athos_musketeer

compiling c & python in Linux

Recommended Posts

i can''t compile a simle c pprogram that uses python. i can''t find any libpython.so or something called like that.i compiled the tar version but no .so was made. anyone can tell me what can i do? that was the command i used: gcc simple.c -I/usr/include/lib/python2.2

Share this post


Link to post
Share on other sites
here i go again.
i installed the rpm all of them. the devel and the other one (the interpreter).
so i try to compile a little c program that embeb pyhton. but i''m missing and so file.
i looked for it but i didn''t find it.
all that i find was a pyhton2.2.a and a python*.o.
so i downloaded the tar and compile it. no errors - no warnings, and also no pyhton2.2.so

where is it??
i''m sure that i''m doing something wrong.
thanks for your concern

Share this post


Link to post
Share on other sites
I think the problem is in your linking. In your post you show:

gcc simple.c -I/usr/include/lib/python2.2 


There is a -I (That's a captial i). I may be wrong, but I think what you want is a -l (That's a lower case L). To quote from the gcc man page:


-llibrary


Use the library named library when linking.

The linker searches a standard list of directories for the library, which is actually a file named `liblibrary.a'. The linker then uses this file as if it had been specified precisely by name.

The directories searched include several standard system directories plus any that you specify with `-L'.

Normally the files found this way are library files--archive files whose members are object files. The linker handles an archive file by scanning through it for members which define symbols that have so far been referenced but not defined. However, if the linker finds an ordinary object file rather than a library, the object file is linked in the usual fashion. The only difference between using an `-l' option and specifying a file name is that `-l' surrounds library with `lib' and `.a' and searches several directories.


I think the .a file is what you want...

-- Aaron

(Edited for readability)

| HollowWorks.com |

[edited by - mrhollow on July 7, 2003 12:20:16 PM]

Share this post


Link to post
Share on other sites
thanks to all.
i already know how to use the gcc and the Is and Ls.

you (mrhollow) were right i need the .a file.

and a lots of others so files.
I already find how to do it. i looked a little inside a makefile.
i have to link it to 10 so files. that''s why the compiler complais about the undefined references.

thanks to all folks.

Share this post


Link to post
Share on other sites