У кого-нибудь есть предложения по расширению Python 3 специально для C ++? Я пытался использовать SWIG, но при попытке доступа к файлу библиотеки, которого нет на моем компьютере (Python_d.lib или что-то подобное), возникает фатальная ошибка ссылки.
EDIT:
Я предпринял следующие шаги:
1) Загрузка swigwin-2.0.4 из http://www.swig.org/download.html
2) Настройка переменных среды (PYTHON_INCLUDE и PYTHON_LIB)
3) Создание одного из примеров, включенных в пакет swigwin. Код для этого размещен ниже. Это было построено в MVSC ++ 2010.
/* File : example.c */
#include "example.h"
#define M_PI 3.14159265358979323846
/* Move the shape to a new location */
void Shape::move(double dx, double dy) {
x += dx;
y += dy;
}
int Shape::nshapes = 0;
double Circle::area(void) {
return M_PI*radius*radius;
}
double Circle::perimeter(void) {
return 2*M_PI*radius;
}
double Square::area(void) {
return width*width;
}
double Square::perimeter(void) {
return 4*width;
}
Соответствующая часть вывода, которую я получаю из этого:
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppBuild.targets(990,5): warning MSB8012: TargetPath(C:\Users\David\Downloads\swigwin-2.0.4\Examples\python\class\.\Debug\example.dll) does not match the Linker's OutputFile property value (C:\Users\David\Downloads\swigwin-2.0.4\Examples\python\class\_example.pyd). This may cause your project to build incorrectly. To correct this, please make sure that $(OutDir), $(TargetName) and $(TargetExt) property values match the value specified in %(Link.OutputFile).
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppBuild.targets(991,5): warning MSB8012: TargetExt(.dll) does not match the Linker's OutputFile property value (.pyd). This may cause your project to build incorrectly. To correct this, please make sure that $(OutDir), $(TargetName) and $(TargetExt) property values match the value specified in %(Link.OutputFile).
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppBuild.targets(992,5): warning MSB8012: TargetName(example) does not match the Linker's OutputFile property value (_example). This may cause your project to build incorrectly. To correct this, please make sure that $(OutDir), $(TargetName) and $(TargetExt) property values match the value specified in %(Link.OutputFile).
1>LINK : fatal error LNK1104: cannot open file 'python32_d.lib'
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:04.27