Author Topic: Help linking Python  (Read 6485 times)

josejps84

  • Guest
Help linking Python
« on: March 09, 2012, 12:20:33 am »
Hi there,

My code is :
Code
#include <python.h>

int main(int argc, char *argv[]) {

Py_Initialize();
PyRun_SimpleString("from time import time,ctime\n"
"print 'Today is',ctime(time())\n");
Py_Finalize();
return 0;
}

I do link the python27.lib in project Build Options
but I get this link error:

Compiling: src\main.cpp
Linking console executable: bin\Release\PythonBind.exe
obj\Release\src\main.o:main.cpp:(.text.startup+0x10): undefined reference to `_imp__Py_Initialize'
obj\Release\src\main.o:main.cpp:(.text.startup+0x25): undefined reference to `_imp__PyRun_SimpleStringFlags'
obj\Release\src\main.o:main.cpp:(.text.startup+0x2b): undefined reference to `_imp__Py_Finalize'
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 0 seconds)
3 errors, 0 warnings

It's like it doesn't link the lib but it found the file 'cause when I put another non-existent lib It tells me that can't be found

Please any help, What do I miss?
Thanks in advance for any help
Greetings

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]