Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why doesn't #include <Python.h> work?

I'm trying to run Python modules in C++ using "#include <Python.h>", however, after setting the "Additional Include Dependencies" of the project to "\include" I get the following error when debuging,

LINK : fatal error LNK1104: cannot open file 'python27_d.lib'

I read that I should download the development version of Python, but I didn't find a link for that, plus, don't I just need the file 'python27_d.lib' to be copied to the "libs" folder?

Please note that I'm using the Anaconda distribution of Python.

Thanks in advance!

like image 992
IssamLaradji Avatar asked Apr 24 '13 19:04

IssamLaradji


People also ask

Is it why don't or why doesn t?

Both don't and doesn't are contractions. Don't is a contraction of do not, while doesn't is a contraction of does not, and they both act as auxiliary verbs. In English, don't is used when speaking in the first and second person plural and singular and the third person plural ("I," "you," "we," and "they").

Is doesn't grammatically correct?

Doesn't vs Don't Often times, 'don't' is used in place of 'doesn't' and that is grammatically incorrect. For example the sentence: She don't know proper English grammar is incorrect. It should read: She doesn't know proper English grammar, or I don't know proper English grammar.

Why don't you or why do you not?

Both are correct. What was originally just a contraction of "do not" has become a word in itself, and can now be placed where the two separate words can't. Both "Don't you..." and "Do you not..." are correct, but you can't re-expand "Don't you..." into "Do not you...".


1 Answers

I normally circumvent this by using the non-debug Python lib in debug builds. Typically, this leads to code like:

#ifdef _DEBUG
  #undef _DEBUG
  #include <Python.h>
  #define _DEBUG
#else
  #include <Python.h>
#endif

where you hide the definition of _DEBUG during the inclusion of Python.h.

like image 116
Klamer Schutte Avatar answered Sep 29 '22 15:09

Klamer Schutte