[python-win32] LNK4197 error building c++ extension

Robin Becker robin at reportlab.com
Fri Aug 17 06:25:48 EDT 2018


I am not a great C++ person so as I am building my first C++ extension I am seeing this error which I don't understand

 > _aggstate.obj : warning LNK4197: export 'init_aggstate' specified multiple times; using first specification
 >    Creating library build\temp.win-amd64-2.7\Release\_aggstate.lib and object build\temp.win-amd64-2.7\Release\_aggstate
 > .exp

I looked in the preprecessor output(_aggstate.i) and see this single occurrence of aggstate_init

> #line 1191 "_aggstate.cxx"
> extern "C" __declspec(dllexport) void init_aggstate(void)
> {
>          aggstate_init();
> }

is this some feature of C++ or is there a real issue here?




> creating build\lib.win-amd64-2.7
> c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\amd64\link.exe /DLL /nologo /INCREMENTAL:NO /LIBPATH:c:\python
> 27\Libs /LIBPATH:C:\code\hg-repos\taggstate\libs /LIBPATH:C:\code\hg-repos\taggstate\PCbuild\amd64 /LIBPATH:C:\code\hg-r
> epos\taggstate\PC\VS9.0\amd64 /EXPORT:init_aggstate build\temp.win-amd64-2.7\Release\_aggstate.obj build\temp.win-amd64-
> 2.7\Release\agg25\src\agg_arc.obj build\temp.win-amd64-2.7\Release\agg25\src\agg_bezier_arc.obj build\temp.win-amd64-2.7
> \Release\agg25\src\agg_curves.obj build\temp.win-amd64-2.7\Release\agg25\src\agg_trans_affine.obj build\temp.win-amd64-2
> .7\Release\agg25\src\agg_vcgen_contour.obj build\temp.win-amd64-2.7\Release\agg25\src\agg_vcgen_stroke.obj /OUT:build\li
> b.win-amd64-2.7\_aggstate.pyd /IMPLIB:build\temp.win-amd64-2.7\Release\_aggstate.lib /MANIFESTFILE:build\temp.win-amd64-
> 2.7\Release\_aggstate.pyd.manifest
> _aggstate.obj : warning LNK4197: export 'init_aggstate' specified multiple times; using first specification
>    Creating library build\temp.win-amd64-2.7\Release\_aggstate.lib and object build\temp.win-amd64-2.7\Release\_aggstate
> .exp


*PS this also occurs when compiling with 3.7, but there the initializer function is PyInit__aggstate
-- 
Robin Becker


More information about the python-win32 mailing list