简体   繁体   English

MagickNet C ++源代码编译失败

[英]MagickNet C++ Source Compilation Failure

I'm attempting to compile a working copy of the MagickNet class library (DLL) using the sources from the ImageMagick and MagickNet libraries. 我正在尝试使用ImageMagick和MagickNet库的源代码来编译MagickNet类库(DLL)的工作副本。

I was unable to obtain a copy of the MagickNet source files from the creator's homepage as it is currently down, so I was forced to obtain the files and C++ project file from here , courtesy of a Google search. 由于无法使用,我无法从创建者的主页上获取MagickNet源文件的副本,因此,由于Google搜索的缘故,我不得不从此处获取文件和C ++项目文件。

Following the instructions stated here and here , I created a project using the "static multi-threaded DLL" option and compiled it, before moving to the MagickNet project file and compiling that as well, after making sure all the paths pointed to the right folders. 按照此处此处说明的说明,在确保所有路径都指向正确的文件夹之后,我使用“静态多线程DLL”选项创建了一个项目并对其进行了编译,然后移至MagickNet项目文件并进行编译。 。

Even so, I keep receiving this error upon compilation: 即使这样,我仍然在编译时收到此错误:

CORE_RL_magick_.lib(nt-base.obj) : error LNK2005: _DllMain@12 already defined in MSVCRT.lib(dllmain.obj)

I also receive 371 other errors, all of them related to an "unresolved external symbol xxxxxxxx", and a final 372nd error describing that I have "195 unresolved externals". 我还收到371个其他错误,所有这些错误均与“未解决的外部符号xxxxxxxx”有关,最后一个第372个错误描述我有“ 195个未解决的外部”。

I managed to solve the DllMain error above by commenting out the DllMain declaration from the nt-base.c source file from the CORE_magick project in the ImageMagick solution, however the 372 other "unresolved externals" errors still remain. 我通过注释掉ImageMagick解决方案中CORE_magick项目的nt-base.c源文件中的DllMain声明,成功解决了上述DllMain错误,但是仍然存在372个其他“未解决的外部错误”。

I had performed a (Google) search for people with similar issues, and some have said that the author had offered a download of a pre-compiled MagickNet DLL which works 100%, however (as I mentioned earlier) his homepage appears to be inaccessible now. 我已经完成了人用类似的问题(谷歌)搜索,以及一些说,提交人提供了一个下载预编译MagickNet DLL但其中工程100%的(正如我前面提到的)他的主页似乎是不可访问现在。

I'm currently seeking one of these solutions: 我目前正在寻找以下解决方案之一:

  1. A solution to my compilation issue, as I may be making a mistake on my part since I'm not familiar with C++ at all, 解决编译问题的方法,由于我一点都不熟悉C ++,因此我可能会犯一个错误,
  2. A link to another MagickNet source files/project zip that is 100% confirmed to compile correctly with the latest version of ImageMagick, 另一个MagickNet源文件/项目zip的链接已被100%确认可以使用最新版本的ImageMagick正确编译,
  3. A link to a 100% working precompiled copy of the MagickNet DLL, if anyone kept a copy from the author's homepage. 如果有人保留了作者主页上的副本,则指向MagickNet DLL的100%有效的预编译副本的链接。 It should be approximately 3MB as it contains the ImageMagick libraries as well. 它也应包含ImageMagick库,大约为3MB。

I would really appreciate any one of these solutions, as I desperately require ImageMagick's ability to manipulate and convert images, as well as MagickNet's ease of use. 我真的很感激这些解决方案中的任何一种,因为我非常需要ImageMagick的处理和转换图像的能力,以及MagickNet的易用性。 I can provide additional details if you need more information. 如果您需要更多信息,我可以提供其他详细信息。

Also, I am using Visual Studio 2008 to compile the source files, and the supplied projects convert with no issues at all. 另外,我正在使用Visual Studio 2008编译源文件,并且所提供的项目转换完全没有问题。

I was just able to get past this and was successfully able to compile MagickNET against the latest version of ImageMagick. 我只是能够克服这一点,并且能够针对最新版本的ImageMagick成功编译MagickNET。 I had to do several things. 我不得不做几件事。

  1. Configured ImageMagick to use StaticMTDll. 将ImageMagick配置为使用StaticMTDll。
  2. Edited magick-config.h to undefine X11 support. 编辑magick-config.h以取消定义X11支持。
  3. Removed the CORE_xlib project from the ImageMagick solution. 从ImageMagick解决方案中删除了CORE_xlib项目。
  4. Clean/Rebuild of ImageMagick 清理/重建ImageMagick
  5. Added the following lib files to the linker settings for MagickNet 将以下库文件添加到MagickNet的链接器设置中

    CORE_DB_bzlib_.lib CORE_DB_bzlib_.lib
    CORE_DB_coders_.lib CORE_DB_coders_.lib
    CORE_DB_jbig_.lib CORE_DB_jbig_.lib
    CORE_DB_jpeg_.lib CORE_DB_jpeg_.lib
    CORE_DB_magick_.lib CORE_DB_magick_.lib
    CORE_DB_png_.lib CORE_DB_png_.lib
    CORE_DB_tiff_.lib CORE_DB_tiff_.lib
    CORE_DB_ttf_.lib CORE_DB_ttf_.lib
    CORE_DB_wand_.lib CORE_DB_wand_.lib
    CORE_DB_wmf_.lib CORE_DB_wmf_.lib
    CORE_DB_zlib_.lib CORE_DB_zlib_.lib
    CORE_DB_libxml_.lib CORE_DB_libxml_.lib
    CORE_DB_jp2_.lib CORE_DB_jp2_.lib
    CORE_DB_lcms_.lib CORE_DB_lcms_.lib
    Ws2_32.lib Ws2_32.lib

  6. Built MagickNet 内置MagickNet

I did have to make updates to MagickNet because methods have been deprecated since the source release on the MagickNet website. 我确实必须对MagickNet进行更新,因为自MagickNet网站上的源代码发布以来,方法已被弃用。 I'll try and put a repository online to share the entire solution. 我将尝试使存储库联机以共享整个解决方案。

I had the exact same problem and Bromanko's answer solved it ...with one minor addition: 我遇到了完全相同的问题,而Bromanko的答案解决了这个问题。。。

in imagemagick's magick-config.h, in addition to commmenting out the line: 在imagemagick的magick-config.h中,除了对这一行进行注释之外:

define MAGICKCORE_X11_DELEGATE

...need to also comment out the line: ...还需要注释掉该行:

define ProvideDllMain

then you'll be cooking with gas. 那就用煤气煮饭。

Thanks bromanko... 谢谢bromanko ...

You're seeing a linker issue due to (I'm guessing, and it seems to be true based on a google search) the link order of the msvcrt and MFC libraries. 由于MSvcrt和MFC库的链接顺序(基于Google搜索,这似乎是正确的),因此您看到了链接器问题。 This article on MSDN seems to have a solution - dated, but the basic issues are the same, and so the options should be similar. 关于MSDN的这篇文章似乎有一个解决方案-已过时,但是基本问题是相同的,因此选项应该相似。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM