<div dir="ltr">Hi all,<div><br></div><div>Compilation of ITK fails on Windows7 with mingw32 gcc4.8. Error was when building libopenjpeg thirdpary. please see the below log on command prompt.</div><div><br></div><div><div>
[ 40%] Building C object Modules/ThirdParty/OpenJPEG/src/openjpeg/CMakeFiles/itk</div><div>openjpeg.dir/openjpeg.c.obj</div><div>D:\sources\InsightToolkit-4.5.2\Modules\ThirdParty\OpenJPEG\src\openjpeg\openjpe</div><div>
g.c:155:1: error: conflicting types for 'DllMain'</div>
<div> DllMain(HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) {</div><div> ^</div><div>In file included from c:\mingw\include\windows.h:62:0,</div><div> from D:\sources\InsightToolkit-4.5.2\Modules\ThirdParty\OpenJPE</div>
<div>G\src\openjpeg\openjpeg.c:29:</div><div>c:\mingw\include\winbase.h:1051:13: note: previous declaration of 'DllMain' was</div><div>here</div><div> BOOL WINAPI DllMain(HINSTANCE, DWORD, LPVOID);</div><div> ^</div>
<div>Modules\ThirdParty\OpenJPEG\src\openjpeg\CMakeFiles\itkopenjpeg.dir\build.make:3</div><div>45: recipe for target 'Modules/ThirdParty/OpenJPEG/src/openjpeg/CMakeFiles/itkop</div><div>enjpeg.dir/openjpeg.c.obj' failed</div>
<div>mingw32-make[2]: *** [Modules/ThirdParty/OpenJPEG/src/openjpeg/CMakeFiles/itkope</div><div>njpeg.dir/openjpeg.c.obj] Error 1</div><div>CMakeFiles\Makefile2:3812: recipe for target 'Modules/ThirdParty/OpenJPEG/src/op</div>
<div>enjpeg/CMakeFiles/itkopenjpeg.dir/all' failed</div><div>mingw32-make[1]: *** [Modules/ThirdParty/OpenJPEG/src/openjpeg/CMakeFiles/itkope</div><div>njpeg.dir/all] Error 2</div><div>Makefile:145: recipe for target 'all' failed</div>
<div>mingw32-make: *** [all] Error 2</div></div><div><br></div><div>This Dllmain conflict can be fixed by adding an ifdef guard for MingW32 along with OPJ_STATIC. Since the error is from thirdparty and must be fixed in their upstream I am not sure about wheather ITK will be patching it in the internal library. I can also confirm that this error is present in trunk version of openjpeg[1]. </div>
<div><br></div><div>[1] <a href="http://openjpeg.googlecode.com/svn/trunk/">http://openjpeg.googlecode.com/svn/trunk/</a> openjpeg-read-only</div><div><br></div><div><br></div><div>-- <br><div><font face="arial, helvetica, sans-serif">Regards,<br>
Rashad</font></div>
</div></div>