Page 1 of 1

Magick++, VC++ 6.0, and Windows XP

Posted: 2013-04-19T22:15:42-07:00
by PriNet
I'm posting this here in the hopes that it will help someone else in my same situation. First, I can't afford the $600 that Microsoft wants to upgrade my VC++ compiler, so I'm stuck with the version 6.0 that I purchased several years ago. After several weeks of researching (about 2 months worth now), I've come to discover that there is not alot of direction or help with this topic. Let me tell you what I have found so far; I can download the ImageMagick source and compile a config program that's supposed to setup a build environment for vc++ 6.0, or, install the ImageMagick binary and setup a couple paths in vc++ 6.0 so it can find certain files.

Ok, for the first 4 to 5 weeks, I attempted the source approach because it seemed the most appropiate since I'm trying to write source. I tried downloading several versions of the source files from ImageMagick (even some older versions that I have archived in my library drive) and started following the directions. Please note, that between each attempt, I reloaded my computer from the restore disks so that there would be no conflict from previous attempts. In each attempt, the configure.dsw in the VisualMagic\configure folder seemed to build and run without any problems. The only change I made in the configure program was the option to create the dsw for vc++ 6.0 due to my requirements. After running the configure program then navigating to the VisualDynamicMT.dsw workspace and loading it, now it got nasty. I tried (several versions of the source files) to build and run the VisualDynamicMT.dsw as instructed (all, release, etc.) and ended up with a mound of errors (as I noticed from forum postings, lots of people have had), to which, never compiled. I battled with this for several weeks until I decided to try the "binary" approach.

The binary approach, well, I got a little further here. I installed (again several versions with the same tactics I used for the source attempts) the binary version of ImageMagick with the Magick++ option checked. I have been using PerlMagick for several years which is why I wanted to stay with it during my c++ quest, because, I just like it, and, I'm familiar with ImageMagicks' approaches. In fact, the program I'm trying to write in c++ is to be a port of a program I wrote in PerlMagick. I'm attempting to do this in c++ because the perl version has a couple of memory leaks and crashes every once in a while (days) and the computer has to be rebooted, but that's another issue. I have researched the perl2exe compiler and discovered it's not real efficient, and it actually packs a portion of the perl interpeter into the exe. Also, I really didn't want to have to install perl on every computer that I wanted to use this program (talk about in-efficiancy). Anyhow, back to my novel; After installing ImageMagick with it's appropiate options then adding a couple of paths to vc++ 6.0 so it could find the Imagemagick Files...

Code: Select all

C:\PROGRAM FILES\IMAGEMAGICK-6.8.4-Q16\INCLUDE
C:\PROGRAM FILES\IMAGEMAGICK-6.8.4-Q16\INCLUDE\MAGICK
C:\PROGRAM FILES\IMAGEMAGICK-6.8.4-Q16\INCLUDE\MAGICK++
I tried to disect the demo files provided in the "C:\Program Files\ImageMagick-6.8.4-Q16\Magick++_Demo" folder pretty intensively, the only "program" I could compile and run without errors was the flip example which is what i used as an example. With the flip program as a kind-of template I came up with the (I might add successfull) source:

Code: Select all

#pragma comment(lib, "CORE_RL_Magick++_.lib")
#pragma comment(lib, "CORE_RL_Magick_.lib")

#include <Magick++.h>
#include <windows.h>
#include <string>
#include <list>

using namespace std;
using namespace Magick;

char *ImageName = "tigger.gif";
char *NewImageName = "test.gif";

int main( int /*argc*/, char ** argv) {
	InitializeMagick(*argv);

	try {
		list<Image> ImageFrame;
		readImages(&ImageFrame,ImageName);
		writeImages(ImageFrame.begin(),ImageFrame.end(),NewImageName);
		}
	catch(exception &error_) {
		printf("Exception Error:\n%s\n",error_.what());
		return 1;
		}
	return 0;
	}
Note the added library pragmas due to vc++ 6.0 needed these directives because they don't come in the default setup, and rather than botch up the (working) compiler, I put them in the top of the source code. Perhaps I'm missing something here also.

So far, so good. As a footnote; the program I'm developing will read in an image (like from a camera) and then compares it to an image I have already saved (ie; motion) and decide whether or not to save the new image then create a seperate animation file. Again, I'm doing this with PerlMagick now. But, back to the novel; I started to do some document reading for Magick++, and supposidly, I should be able to use "ImageFrame.read(ImageName)" (with the proper "Image ImageFrame" declaration) for just one "frame" image instead of the multiple frame read I'm using above. Therefore, I attempted this:

Code: Select all

#pragma comment(lib, "CORE_RL_Magick++_.lib")
#pragma comment(lib, "CORE_RL_Magick_.lib")

#include <Magick++.h>
#include <windows.h>
#include <string>
#include <list>

using namespace std;
using namespace Magick;

char *ImageName = "tigger.gif";
char *NewImageName = "test.gif";

int main( int /*argc*/, char ** argv) {
	InitializeMagick(*argv);

	try {
		Image ImageFrame;
		ImageFrame.read(ImageName);
		ImageFrame.write(NewImageName);
		}
	catch(exception &error_) {
		printf("Exception Error:\n%s\n",error_.what());
		return 1;
		}
	return 0;
	}
Well, it compiled ok:

Code: Select all

Compiling...
Prog.cpp
Linking...

Prog.exe - 0 error(s), 0 warning(s)
But after it builds and starts to run, I get a big window "Prog.exe has encountered a problem and needs to close. We are sorry for the inconvenience." and when I select the [Debug] button i get "Unhandled exception in Prog.exe (MSVCR100.DLL) 0xC0000005 Access Violation" with a pointer in the debug window to "78AA1ED7 rep movs dword ptr [edi],dword ptr [esi]" which I'm sure doesn't help, but, the program crashed.

I'm not fluent with c++, I'm learning as I go, but I am pretty good with assembly(machine) code, basic (of course), and perl, I have written several programs in those languages, but, as windows gets more complicated, it's getting harder to implement assembly into windows, which is why I'm hitting C++.

In closing my little novel here, my goal is to hopefully find someone out there that has successfully got Magick++, VC++ 6.0, and Windows XP to work together so the "ImageFrame.read" function, along with (I'm sure), "ImageFrame.compare" functions work in their source so I can continue my little adventure (Preferably, an idiots step by step *heh*). I'm sure I'm missing something, somewhere, somehow, but, without much documentation on the net about windows on this topic, I'm hoping someone can help with (maybe) an example of a simple read/write source using Magick++ with the appropiate "links", includes, headers, required (that I seem to be missing) to make it work with a fresh VC++ 6.0 with service pack and redistributable install similar to my example above.

Thanx for taking the time to read this. Your web browser will recieve a cookie soon.

-Gary :?

Re: Magick++, VC++ 6.0, and Windows XP

Posted: 2013-04-20T06:04:59-07:00
by magick
A few years ago we dusted off our Visual C++ 6.0 compiler to ensure the ImageMagick distribution would build, it did so we moved on. We're also not sure an ImageMagick build with VS10 (the IM windows distribution) can link with VS 6. If nothing else, the C++ decorations are probably different. You're right about the VS compiler costs, that is why we primarily build in a Linux environment where all the software is free. One solution might be to build ImageMagick under Cygwin or Ming / MSYS. They are free, include free compilers, and produce executables that will run under Windows. With Cygwin, for example, here are the commands to build a Magick++ program:

Code: Select all

wget http://www.imagemagick.org/download/ImageMagick-6.8.4-10.tar.gz
tar xvf ImageMagick-6.8.4-10.tar.gz
cd ImageMagick-6.8.4-10
./configure
make
make install
g++ `Magick++-config --cxxflags --cppflags` -O2 -Wall -o magick++ magick++.cpp `Magick++-config --ldflags --libs`
Perhaps another user with more experience with Windows compiler hell can help you with the VS compiler / link problem.

Re: Magick++, VC++ 6.0, and Windows XP

Posted: 2013-04-20T07:36:26-07:00
by PriNet
Thanks for getting back to me. I understand that more and more people are turning to linux because Microsoft is getting so greedy. I actually have one computer in the back here running linux with ubuntu on it that I am trying to learn on, but, alas, I learned computers back in the DOS days, and, I'm told... that was probably the worst thing to do before learning linux... I wish I understood linux more than "simple" line commands past the gui. I have a terrible time with it. I will spend the next few weeks trying to figure out how to setup a compiler on it. I'm slow and inexperienced (bad) with linux. I will also look into this cygwin option you mention... it sounds like this is a "linux" emulator? Thats just as scarry as trying to crash my linux machine, but, thanx again for the reply, and I do hope (like you mention) that someone out there that has successfully married the objects of this post in a white picketed fenced house will open their doors and share the wealth of information they can provide on the subject (is that a little thick or what ?). Thanx again, off to research land, and hope to hear more from, well, anyone soon.

May your little binary bits grow up to be large bytes.

-Gary

Re: Magick++, VC++ 6.0, and Windows XP

Posted: 2013-04-21T23:25:41-07:00
by PriNet
"Magick":
I did soom research and decided to try the cygwin approach you mentioned to see if I could get that going. I followed your instructions above, ordered a pizza, got thru the configure procedure... started the first make, and while the second make install was finishing up, my pizza got here. I recognized alot of information as it was flying by and started getting a little optimistic, alot of what I was seeing was stuff I had seen in some of my research and I thought to my self, "self... this may actually happen!". well everything looked good (so was my pizza) up until i tried the line:

Code: Select all

g++ `Magick++-config --cxxflags --cppflags` -O2 -Wall -o magick++ magick++.cpp `Magick++-config --ldflags --libs`
I got an error "g++: magick++.cpp: No such file or directory"..... rats, er, I mean, darn...

I checked the directory "Magick++" for a file named "magick++.cpp" thinking you overlooked the "/" and didn't see it. This looks like the closest I've been to getting back to my project, then this happened. Can I bother you one more time to check that line and see what went wrong? Or, did the compilation not work like I expected? I did see a few "Ignored" notices go by during the compilation, but didn't see what they were really, they cruised by pretty quick. Again, I thank you for getting me to here, I hope you can help me get this going... And, of course, I hope this helps anyone else in my predicament...

-G

Re: Magick++, VC++ 6.0, and Windows XP

Posted: 2013-04-22T04:12:52-07:00
by magick
magick++.cpp is your custom Magick++ API source code. In your example, you called it Prog.cpp.

Re: Magick++, VC++ 6.0, and Windows XP

Posted: 2013-04-22T16:03:40-07:00
by PriNet
ooops, ok, I see what you mean... -o is the output file, I should have caught that. Lemmie play with this a bit then I'll sum up everything to close up this thread. Gimmie some time, I'm working some long hours the next couple days. Thanx a gig for your guidance so far.

-G :)

Re: Magick++, VC++ 6.0, and Windows XP

Posted: 2013-04-28T20:15:47-07:00
by PriNet
I haven't given up on this yet, I'm still researching and attempting... Do you remember which version of ImageMagick was the last one you mentioned that compiled with VC++ 6.0 ? I'm probably going to start trying with the oldest version I can find which is... 5.5.7 Or was it even older ?

Re: Magick++, VC++ 6.0, and Windows XP

Posted: 2013-08-17T22:46:20-07:00
by PriNet
Ok, I'm right at the point of losing my mind. I have been researching and working on this simple read in image problem for several weeks now. I have tried every version of imagemagick I can find at sourceforge, reloaded "alot" of times, did learn a couple of things on how to setup vc++ 6.0 per project in the c/c++ and link sections, but I still can not get (even in the demos provided) to get

Code: Select all

#include <Magick++.h>
#include <list>

Image NameOfImage;
NomeOfImage.read("Dummy.gif");
To work without these errors:

Code: Select all

Loaded symbols for 'C:\Program Files\Microsoft Visual Studio\MyProjects\Grabit\Debug\Grabit.exe'
Loaded 'C:\WINDOWS\system32\ntdll.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\kernel32.dll', no matching symbolic information found.
Loaded 'C:\Program Files\ImageMagick\CORE_RL_Magick++_.dll', no matching symbolic information found.
Loaded 'C:\Program Files\ImageMagick\CORE_RL_magick_.dll', no matching symbolic information found.
Loaded 'C:\Program Files\ImageMagick\X11.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\msvcrt.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\wsock32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\ws2_32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\ws2help.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\advapi32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\rpcrt4.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\user32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\gdi32.dll', no matching symbolic information found.
Loaded 'C:\Program Files\ImageMagick\CORE_RL_bzlib_.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\msvcr100.dll', no matching symbolic information found.
Loaded 'C:\Program Files\ImageMagick\CORE_RL_lcms_.dll', no matching symbolic information found.
Loaded 'C:\Program Files\ImageMagick\CORE_RL_ttf_.dll', no matching symbolic information found.
Loaded 'C:\Program Files\ImageMagick\CORE_RL_zlib_.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\vcomp100.dll', no matching symbolic information found.
Loaded 'C:\Program Files\ImageMagick\CORE_RL_wand_.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\msvcp100.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\urlmon.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\ole32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\oleaut32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\shlwapi.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\iertutil.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\imm32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\lpk.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\usp10.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\WinSxS\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.2600.2180_x-ww_a84f1ff9\comctl32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\uxtheme.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\MSCTF.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\MSCTFIME.IME', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\version.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\wininet.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\normaliz.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\secur32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\shell32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\comctl32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\rasapi32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\rasman.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\netapi32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\tapi32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\rtutils.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\winmm.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\userenv.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\msv1_0.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\iphlpapi.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\sensapi.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\mswsock.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\hnetcfg.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\wshtcpip.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\rasadhlp.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\dnsapi.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\apphelp.dll', no matching symbolic information found.
The thread 0x1E4 has exited with code 0 (0x0).
The thread 0x850 has exited with code -1073741819 (0xC0000005).
The thread 0xEC has exited with code -1073741819 (0xC0000005).
The thread 0xF8 has exited with code -1073741819 (0xC0000005).
The thread 0x87C has exited with code -1073741819 (0xC0000005).
The thread 0xC64 has exited with code -1073741819 (0xC0000005).
The thread 0xBA0 has exited with code -1073741819 (0xC0000005).
The program 'C:\Program Files\Microsoft Visual Studio\MyProjects\Grabit\Debug\Grabit.exe' has exited with code -1073741819 (0xC0000005).
Am I missing a path? I tried using this approach in the demo "flip" program which works fine with

Code: Select all

    list<Image> imageList;
    readImages( &imageList, srcdir + "smile_anim.miff" );
thats provided, but I can not get it to work when I replace it with

Code: Select all

    Image imageList;
    ImageList.read( "smile_anim.miff" );
in the same source file, I get the same errors as above. I can't even start the "ImageList.compare()" function without being able to load the first image. I'm not working with frames, just single images.
Can anyone please explain to me why I can't get the .read to work? This is really fustrating, because I am able to use the perlmagick port without hardly any issues, I just can't seem to get the magick++ port to work.

Re: Magick++, VC++ 6.0, and Windows XP

Posted: 2013-08-18T04:00:36-07:00
by dlemstra
You cannot use the binaries that are compiled with Visual Studio 2010 with your VC++ 6.0 program. You should really compile the source of ImageMagick with VC++ 6.0. Or if you project is not a commercial project you could switch to the latest Visual C++ Express edition. If you want you can contact me and send me your error messages so I can try to get configure.exe working again for VC++ 6.0.

Re: Magick++, VC++ 6.0, and Windows XP

Posted: 2013-08-18T13:31:25-07:00
by PriNet
Let me reiterrate, I have notes and notes here and do intend on posting my results with how I setup everything to work with vc++ 6.0 when I can get it going. I am going to retrace some steps and do the compiling you requested with different versions of imagemagick that I have aquired soon here. Which version would you prefer from me for the results? An older version that produces fewer errors or the newer one so you can see what that produces? I will post up whatever you and I come up with as far as results because this topic looks like it has been viewed several times and others would like to see what comes out of this. It seems, I'm not the only one in this boat. Let me know how you would like my results, and I'm going to get started on it here probably by wednessday (this is a hobby, I still have to pay the bills *heh*). I really am trying to use 6.0 here because (as I mentioned before) don't have the $600+ for the newer version, as I'm sure it is with alot of hobbiest, and I rather use "real" software over "express" versions, due to, I'm not sure what I intend to do with my programs once they are polished up and working as expected. Let me say , "thank you, thank you, thank you" for offering to help me get this going, I've used imagemagick in perl with great success in the past (again as I mentioned before) and would really like to be able to port some of my perl programs to c++ for effeciency. I will be happy to share results I get once I can get this to work. Thanx again.

Re: Magick++, VC++ 6.0, and Windows XP

Posted: 2013-08-18T15:06:31-07:00
by dlemstra
Please use the latest version of ImageMagick 6. Feel free to checkout from the SVN repsitory: https://subversion.imagemagick.org/subv ... -Windows-6.

Re: Magick++, VC++ 6.0, and Windows XP

Posted: 2013-08-18T19:46:08-07:00
by PriNet
“Re-ghosted” my computer back to before I tried installing anything to do with ImageMagick, then started "configure.dsw" in "C:\ImageMagick-6.8.6\VisualMagick\configure". I read somewhere I needed to set the active project to “Release”, so, [Build] → [Set Active Configuration] → [configure – Win32 Release]. Then [Build] → [Build configure.exe], and received these errors:

Code: Select all

--------------------Configuration: configure - Win32 Release--------------------
Compiling resources...
Compiling...
stdafx.cpp
Compiling...
configure.cpp
C:\ImageMagick-6.8.6\VisualMagick\configure\configure.cpp(4360) : error C2360: initialization of 'it' is skipped by 'case' label
        C:\ImageMagick-6.8.6\VisualMagick\configure\configure.cpp(4355) : see declaration of 'it'
C:\ImageMagick-6.8.6\VisualMagick\configure\configure.cpp(5146) : error C2360: initialization of 'it' is skipped by 'case' label
        C:\ImageMagick-6.8.6\VisualMagick\configure\configure.cpp(5141) : see declaration of 'it'
configure_wizard.cpp
finished_page.cpp
system_page.cpp
target_page.cpp
WaitDlg.cpp
welcome_page.cpp
Generating Code...
Error executing cl.exe.

configure.exe - 2 error(s), 0 warning(s)
Here are the sections that burped:

Code: Select all

void ConfigureVS6Project::write_link_tool_begin( const char *input_path,
 const char *output_path,
 list<string> &additional_libdir_list,
 int type, int mode )
{
  switch (type)
    {
    case DLLPROJECT:
    case EXEPROJECT:
      m_stream << "LIB32=link.exe -lib" << endl;
      m_stream << "LINK32=link.exe" << endl;
      m_stream << "# ADD LINK32";
      m_stream << " /libpath:\"";
      for (list<string>::iterator it = additional_libdir_list.begin(); 
           it != additional_libdir_list.end(); it++)
        m_stream << *it << ";";
      m_stream << input_path << "\"";
      break;
    case LIBPROJECT:
      m_stream << "LIB32=link.exe -lib" << endl;
      m_stream << "# ADD LIB32";
      break;
    }
}
And:

Code: Select all

void ConfigureVS7Project::write_link_tool_begin( const char *input_path,
 const char *output_path,
 list<string> &additional_libdir_list,
 int type, int mode )
{
 m_stream << "      <Tool" << endl;
 switch (type)
 {
 case DLLPROJECT:
 case EXEPROJECT:
 m_stream << "        Name=\"VCLinkerTool\"" << endl;
 m_stream << "        AdditionalLibraryDirectories=\"";
 for (list<string>::iterator it = additional_libdir_list.begin(); 
 it != additional_libdir_list.end(); it++)
 m_stream << *it << ";";
 m_stream << input_path << "\"" << endl;
 break;
    case LIBPROJECT:
      m_stream << "        Name=\"VCLibrarianTool\"" << endl;
      break;
    }
}
I stopped here to wait for further instructions.

Re: Magick++, VC++ 6.0, and Windows XP

Posted: 2013-08-19T00:13:20-07:00
by dlemstra
Would you mind contacting me trough the forum so we can swap e-mails? I don't have VC++ 6.0 so I cannot tests any of the changes I will post and instead of spamming the forum I rather just spam you :). We should however post updates here to inform others what is happening.

Re: Magick++, VC++ 6.0, and Windows XP

Posted: 2013-08-20T17:54:33-07:00
by PriNet
Done... and thanx, I don't have much hair left (*heh*)... I will put up whatever comes of this, It looks like this gets viewed quite a bit.

Confucius says;
If everything is going your way....
your probably in the wrong lane.