C \ Python Interface

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

-Fabez-

Thread Starter
Joined
Jul 28, 2008
Messages
1,899
I am trying to use some Python functions from C, using Dev C++ compiler. However, everything I try does not work, as it gives me a compiler and linker error, every time I try to compile the C code. Any input or help would be much appreciated. Thanks -Fabez-
 

-Fabez-

Thread Starter
Joined
Jul 28, 2008
Messages
1,899
Sorry, the code I am trying to compile is.

Code:
#include "Python.h"
#include <stdio.h>
int main(){
    Py_Initialize();
    PyRun_SimpleString("Test=[1,2,3,4]");
    Py_Finalize();
}
And the error's I am getting are.

Code:
[Linker error] undefined reference to `_imp__Py_Initialize' 
  [Linker error] undefined reference to `_imp__PyRun_SimpleStringFlags' 
  [Linker error] undefined reference to `_imp__Py_Finalize' 
  ld returned 1 exit status
 

-Fabez-

Thread Starter
Joined
Jul 28, 2008
Messages
1,899
Thanks :D How would I link them ? The Python include directory is listed under the include options for Dev C++, but it still does not work.
 
Joined
Sep 14, 2005
Messages
919
Thanks :D How would I link them ? The Python include directory is listed under the include options for Dev C++, but it still does not work.
The linker does not use include files nor know what they are. You need to link in the library files (Usually static library files, which are *.lib) within your linker settings.

I never used Dev-C++ though so cannot directly help with that :) I can see if I can post a link to a tutorial (or similar) later if you are still having the problems later ;)
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 807,865 other people just like you!

Latest posts

Top