Skip to main content
gamedev.net
🔒 Locked

Embedding python in c++

Started by guywithknife Feb 19, 2003 at 2:18 PM 5 replies 350+ views
Original Post
guywithknife
guywithknife
I''ve read the python documentation and i think i know how to run python scripts from within my c++ programs, but i cant get it compiled... Actually, it does compile fine, but the linker tells me something along the lines of "undefined refference to Py_Initialize" I added the python21.lib to my project but it doesnt make one bit of difference. Im using Dev-C++ 4 and usually i use .a files for libraries (libSDL.a, libOpengl32.a etc) and the documentation assumes you use MSVC on windows, so can Dev-C++ not use .lib''s or what? Or should i be using a different library file, if so where do i get it? I''ve searched the docs, the python website and tried google but can''t find anything. Someone else must have got this working before... any help would be greatly appreciated. Thanks in advance.
guywithknife
guywithknife
Comon, someones gotta know...
I read piles on it but cant find help.. its sposed to be easy yet i cant seem to link the program (stupid linker)..

Please someone help!!
nonnus29
nonnus29
No Mingw (the compiler that comes with dev c++) cannot use .lib ''s.

There was a tute posted around here at one time about using a tool that comes with mingw (in your mingw bin directory probably) to convert msvc libs to .a''s. I''m too lazy to hunt it up again though. Or you can compile python from the source with your compiler then you will have everything you need.
Fruny
Fruny
Have you tried compiling the python interpreter/library yourself, or converting the .lib for use with mingw-gcc ?


[ Start Here ! | How To Ask Smart Questions | Recommended C++ Books | C++ FAQ Lite | Function Ptrs | CppTips Archive ]
[ Header Files | File Format Docs | LNK2001 | C++ STL Doc | STLPort | Free C++ IDE | Boost C++ Lib | MSVC6 Lib Fixes ]
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan
guywithknife
guywithknife
Thanks for the replies.

I didn''t try to to compile the source, i did download it, but there was so much stuff there i decided against trying to compile it myself.
I downloaded the files from the pyopengl site and im gonna test them now, but it has the .a files so it should work.

About converting the files, how would i do that, what programs do i ned and where could i get it? I checked in the bin directory where the mingw32 compiler is but i couldn''t find a program for converting .libs, or at least i dont think theres one there, i tried running them all to see what they do from the messages they output but none of them seemed to be what i was looking for.
I''d like to be able to convert them for future use, but its not necessary right now.

Thanks again, i appreciate it.
Fruny
Fruny
Pass the --help flag to those programs.
You might have something like libtool.


[ Start Here ! | How To Ask Smart Questions | Recommended C++ Books | C++ FAQ Lite | Function Ptrs | CppTips Archive ]
[ Header Files | File Format Docs | LNK2001 | C++ STL Doc | STLPort | Free C++ IDE | Boost C++ Lib | MSVC6 Lib Fixes ]
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.