Page 1 of 1

Compiling in Visual Studio 2010

Posted: 2010-06-16T10:18:41-07:00
by stevepugh
Greetings all,
I've just yesterday downloaded the trial for MS Visual Studio 2010 and ImageMagick 6.6.2 source. I know that http://www.imagemagick.org/script/advan ... lation.php lists VS 6 and VS7 as supported, but I could not find links to download them from MS' website and so I grabbed what was jumping out from the webpage.

I am able to open, convert, and compile configure.sln with some warnings but no errors, but when I run the resulting configure.exe I encounter two problems - (1) An attempt to click the "Edit magick-config.h" button tells me that the file cannot be found, and (2) the resulting VisualStaticMT.sln fails the conversion to 2010 format with the following error in the conversion report:

Code: Select all

Conversion Report - All\All.vcproj: 
Converting project file 'C:\Users\spugh\Documents\Visual Studio 2010\Projects\ImageMagick-6.6.2\VisualMagick\configure\Debug\All\All.vcproj'. 
File 'C:\Users\spugh\Documents\Visual Studio 2010\Projects\ImageMagick-6.6.2\VisualMagick\configure\Debug\All\All.vcproj' was not found. 
Project upgrade failed. 
Sure enough, that folder does not exist. I see a folder ..\VisualMagick\All, but the files therein are old. Should I copy them over? It seems like I should be looking for some newly-created files that configure.exe spits out, no?

I figure this might be related to using 2010 for my initial build of configure.exe, but can anyone give me more insight? I am far from a C++ genius, and definitely not fluent in the Visual Studio environment.

Many thanks,
Steve

Re: Compiling in Visual Studio 2010

Posted: 2010-06-16T12:46:17-07:00
by el_supremo
First you need to figure out why "Edit magick-config.h" fails. When you click that button, the target-page.cpp module of the configure program calls notepad and passes it the filename "..\\magick\\magick-config.h.in". So make sure that this file is in the distribution and also check that the path to it is correct.

Pete

Re: Compiling in Visual Studio 2010

Posted: 2010-06-16T14:32:40-07:00
by stevepugh
Thank you kindly, Pete!

Hrmmm, indeed the folder structure was such that the configure.exe was written to ...ImageMagick-6.6.2\VisualMagick\configure\Debug\configure\, which has no matching folder called "..\\magick\\". If I move my configure.exe up two levels to ...ImageMagick-6.6.2\VisualMagick\configure\, then I can indeed edit the magick-config.h.in file from that button.

However, when I run configure.exe from this folder (staticMT, all other options default), I get an error dialog reading:
  • Debug Assertion Failed!
    Program: ...ojects\ImageMagick-6.6.2\VisualMagick\configure\configure.exe
    File: f:\dd\vcctools\vc7libs\ship\atlmfc\src\mtc\thrdcore.cpp
    Line: 168
Now, that file confuses me because I don't even have an f: drive....did I mention I am FAR from a Visual Studio-savvy individual? 's true.

Re: Compiling in Visual Studio 2010

Posted: 2010-06-16T17:48:03-07:00
by el_supremo
Sometimes there's been problems with the debug libraries not getting along together. Try setting the configure program's build configuration to Release and see if that one runs.

Pete

Re: Compiling in Visual Studio 2010

Posted: 2010-06-17T14:24:47-07:00
by stevepugh
That did the trick, El_Supremo, thanks much! Now all I need to do is sort out the 'unresolved external symbol' errors that I'm getting with all of the symbols in _ReadEXRImage and _WriteEXRImage. Hello, Google, help me learn things!

Re: Compiling in Visual Studio 2010

Posted: 2010-06-17T15:02:58-07:00
by el_supremo
These are my notes on getting EXR to work with my (older) version of Visual Studio.

In the Properties of the IM_MOD_exr project:
- in C/C++|General|Additional Include Directories, add the path to the Deploy include directory e.g. c:\Deploy\include
- in linker|General|Additional Library Directories, add the path to the Deploy library: c:\Deploy\lib\Release
- in linker|Input|Additional Dependencies, add zdll.lib, Imath.lib, IlmThread.lib, IlmImf.lib, Iex.lib, Half.lib
(Note that when you make changes to each of these properties you must select Apply or the change won't take effect)

Pete

Re: Compiling in Visual Studio 2010

Posted: 2010-06-18T10:35:32-07:00
by stevepugh
UPDATE: Hardly the appropriate fix, but hard-pathing the various folders and files in this line (Properties/Post-Build) caused IlmImf to compile properly and generate an IlmImf.dll file. That's the good news, the bad news is that I still don't know why I don't have an IlmImf.LIB file anywhere to be found!!


Thanks again, Peter, I'm getting so close I can taste it! (Of course, it tastes like raw pixels, and that's kinda gross)

I found that I needed to build OpenEXR to get the libs all sorted - ilmBase is all built but when trying to generate the IlmImf library I get an error during linking:

Code: Select all

1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error MSB3073: The command "..\..\..\..\..\..\Deploy\bin\Release\createDLL -n..\Release\IlmImf.map -lRelease\;..\..\..\..\..\..\Deploy\lib\Release\ -i..\Release\IlmImf.lib && ..\..\..\installIlmImf.cmd Release\
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error MSB3073: :VCEnd" exited with code -1.
1>
From what I can see online, this might mean that something (my createDLL executable, perhaps, or one of the libraries?) is not in the correct path. Am I just counting those ellipses and backslashes to count up and make sure everyone is sitting where they're supposed to be?

Thank you again for helping me take my first toddling steps with this, today has seen good progress indeed!

Best,
Steve

Re: Compiling in Visual Studio 2010

Posted: 2010-06-18T11:04:53-07:00
by el_supremo
That command is in the IlmImf properties for Build Events|Post-build event and is exactly the same as is in my compiler. So it looks like, as you surmise, there's a problem with the pathnames. Have a look in your Deploy\Bin\Release directory and make sure that createDLL.exe is there, then check the other paths.
Mine didn't fail here so I don't know what else to suggest.

Pete

Re: Compiling in Visual Studio 2010

Posted: 2010-06-18T11:11:25-07:00
by stevepugh
Thanks, Peter, that was indeed the issue - got it to build the IlmImf project successfully, but I'm a bit stumped as to where I would look now to generate the IlmImf.lib file that ImageMagick wants - that build of the IlmImf project generated a DLL but no LIB file. Yeah, that's right, I'm getting every newb question out in one thread, yay me ;-)

Cheers,
Steve

Re: Compiling in Visual Studio 2010

Posted: 2010-06-18T14:17:56-07:00
by el_supremo
The lib file should be in the same directory as the dll. But just to be sure, check these properties of the IlmInf project and compare with my system:
in Linker|General the Output File is set to $(OutDir)/IlmImf.dll
and in Linker|Advanced the Import Library is set to $(OutDir)/IlmImf.lib
They both output to $OutDir which in my setup is ..\Release (which you can check in General|Output Directory)

Pete

Re: Compiling in Visual Studio 2010

Posted: 2010-06-21T09:39:59-07:00
by stevepugh
Hi Pete,

Just wanted to pass along a hearty THANK YOU for all of your help. Finally got everything to compile properly on Friday afternoon, and was able to convert an EXR image into JPEG, so now I've got an ImageMagick project that works and I feel like the sky is the limit. At least the fairly low parts of the sky, where my programming skills can reach.

Your advice has been greatly appreciated!

Best,
Steve

Re: Compiling in Visual Studio 2010

Posted: 2010-09-11T18:56:29-07:00
by pengyuzhao
hi,
I have the same question as you,and I don't know how to link the openexr to the IMageMagick. I have builded the openexr from source code.in the source file ,there is an createdll file.How to use it ?how to fix the openexr files(including lib and dll)?In fact,I didn't resolve this question:the 'unresolved external symbol' errors in _ReadEXRImage and _WriteEXRImage.


Your advice has been greatly appreciated!

Best,
pengyuzhao