使用MinGW链接到Python时,如何解决“ _imp__Py_IsInitialized”的未定义引用错误

时间:2019-02-16 12:14:18

标签: python gcc undefined-reference

如何解决“ temp \ ccSZ9gCR.o ....未定义对'_imp__Py_Initialize'错误的引用?

我使用MinGW编译一个包含$datastores = Get-Datastore $allstoreinfo = @() foreach($store in $datastores){ $storeinfo = "" | Select Name, FileSystem, Type, CapacityGB, FreeSpaceGB $datastoreview = get-datastore -Name $store.Name | Get-View | select -ExpandProperty summary $CapacityGB = [math]::round($datastoreview.Capacity/1GB,2) $FreeSpaceGB = [math]::round($datastoreview.FreeSpace/1GB,2) $ProvisionedGB = [math]::round(($datastoreview.Capacity - $datastoreview.FreeSpace + $datastoreview.Uncommitted)/1GB,2) $storeinfo.Name = $store.Name $storeinfo.FileSystem = $store.FilesystemVersion $storeinfo.Type = $store.Type $storeinfo.CapacityGB = $CapacityGB $storeinfo.FreeSpaceGB = $FreeSpaceGB $allstoreinfo += $storeinfo } Write-Host "---------------------------------" $allstoreinfo | Select Name, FileSystem, Type, CapacityGB, FreeSpaceGB Write-Host "---------------------------------" 的c ++文件。

<python.h>

它返回错误g++ -Ic:\ProgramData\Anaconda3\include test.cpp

我该如何解决?

p.s。 ,我想将python嵌入C ++。首先,我想我应该使用-I -L添加一些要包含的目录。 我将g ++命令更改为:

temp\ccSZ9gCR.o....undefined reference to `_imp__Py_Initialize'

在libs目录中,有python3.lib和python37.lib文件。 但是我仍然得到相同的错误结果。

0 个答案:

没有答案