Compiling in Visual Studio 2010

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
stevepugh
Posts: 43
Joined: 2008-01-21T12:34:36-07:00

Compiling in Visual Studio 2010

Post 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
el_supremo
Posts: 1015
Joined: 2005-03-21T21:16:57-07:00

Re: Compiling in Visual Studio 2010

Post 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
Sorry, my ISP shutdown all personal webspace so my MagickWand Examples in C is offline.
See my message in this topic for a link to a zip of all the files.
stevepugh
Posts: 43
Joined: 2008-01-21T12:34:36-07:00

Re: Compiling in Visual Studio 2010

Post 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.
el_supremo
Posts: 1015
Joined: 2005-03-21T21:16:57-07:00

Re: Compiling in Visual Studio 2010

Post 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
Sorry, my ISP shutdown all personal webspace so my MagickWand Examples in C is offline.
See my message in this topic for a link to a zip of all the files.
stevepugh
Posts: 43
Joined: 2008-01-21T12:34:36-07:00

Re: Compiling in Visual Studio 2010

Post 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!
el_supremo
Posts: 1015
Joined: 2005-03-21T21:16:57-07:00

Re: Compiling in Visual Studio 2010

Post 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
Sorry, my ISP shutdown all personal webspace so my MagickWand Examples in C is offline.
See my message in this topic for a link to a zip of all the files.
stevepugh
Posts: 43
Joined: 2008-01-21T12:34:36-07:00

Re: Compiling in Visual Studio 2010

Post 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
el_supremo
Posts: 1015
Joined: 2005-03-21T21:16:57-07:00

Re: Compiling in Visual Studio 2010

Post 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
Sorry, my ISP shutdown all personal webspace so my MagickWand Examples in C is offline.
See my message in this topic for a link to a zip of all the files.
stevepugh
Posts: 43
Joined: 2008-01-21T12:34:36-07:00

Re: Compiling in Visual Studio 2010

Post 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
el_supremo
Posts: 1015
Joined: 2005-03-21T21:16:57-07:00

Re: Compiling in Visual Studio 2010

Post 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
Sorry, my ISP shutdown all personal webspace so my MagickWand Examples in C is offline.
See my message in this topic for a link to a zip of all the files.
stevepugh
Posts: 43
Joined: 2008-01-21T12:34:36-07:00

Re: Compiling in Visual Studio 2010

Post 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
pengyuzhao

Re: Compiling in Visual Studio 2010

Post 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
Post Reply