[solved]successful build/compile using GCC/Ubuntu and Windows VS2015 CMD Prompt. but cant get IDE to build. Code::BLocks
Posted: 2016-07-04T22:45:02-07:00
Hello,
So i can say I was successful in building/compiling a MagickWand script with VisualStudio 2015 Native Tools x64 Command Prompt as well as through the terminal in Ubuntu using gcc.
The GCC code from the MagickWand example page :http://www.imagemagick.org/script/magick-wand.php
Can be converted to windows command line syntax as : (*must be entered into the VS2015 Native Tools CMD Prompt. Not the normal CMD.exe)
Maybe someone knows a better way to do it using this method but this works with out any errors.
However, what i will continue to try to figure out is that I cant get a basic MagickWand script to build in an IDE. I am using Code::Blocks because it is cross platform windows/ubuntu and on both OS's I get the same errors. I believe it has to do with properly linking the header and lib files.
Does anyone have any sources for properly setting up your environment when using MagickWand and an IDE ?
Thank You for your time.
My MagickWand code in file "wandTest.c":
In Code::Blocks I have the directory paths for the MagickWand headers and the 'Lib' directory defined in the 'Project -> Build Options -> Search Directories -> Compiler and Link options (respectively) so the compiler will search for the files in those locations. but I get these errors:
Version: ImageMagick 7.0.2-2 Q16 x64 2016-07-03 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2015 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Visual C++: 190023918
Features: Debug Cipher DPC HDRI Modules OpenMP
Delegates (built-in): bzlib cairo flif freetype jng jp2 jpeg lcms lqr openexr pangocairo png ps rsvg tiff webp xml zlib
So i can say I was successful in building/compiling a MagickWand script with VisualStudio 2015 Native Tools x64 Command Prompt as well as through the terminal in Ubuntu using gcc.
The GCC code from the MagickWand example page :http://www.imagemagick.org/script/magick-wand.php
Code: Select all
cc -o wand wand.c `pkg-config --cflags --libs MagickWand`
Code: Select all
cl -Fo:WandConvert /I C:\ImageMagick-7.0.2-2\ImageMagick wandTest.c /Link C:\ImageMagick-7.0.2-2\VisualMagick\lib\CORE_DB_MagickWand_.lib
However, what i will continue to try to figure out is that I cant get a basic MagickWand script to build in an IDE. I am using Code::Blocks because it is cross platform windows/ubuntu and on both OS's I get the same errors. I believe it has to do with properly linking the header and lib files.
Does anyone have any sources for properly setting up your environment when using MagickWand and an IDE ?
Thank You for your time.
My MagickWand code in file "wandTest.c":
Code: Select all
#include "MagickWand/MagickWand.h"
int main(int argc, char *argv[])
{
MagickWand *newWand;
MagickWandGenesis();
newWand = NewMagickWand();
MagickReadImage(newWand, "target.tif" );
MagickWriteImage(newWand, "target.jpg" );
if(newWand) DestroyMagickWand(newWand);
void MagickWandTerminus(void);
return 0;
}
I stalled from source on both Windows 10 x64 and Ubuntu 14.04 x64-------------- Build: Debug in wandTest (compiler: GNU GCC Compiler)---------------
gcc -Wall -g -I/usr/local/include/ImageMagick-7/ -I/usr/local/include/ImageMagick-7/ -c /home/joseph/Desktop/Magick/cBlocks/wandTest/main.c -o obj/Debug/main.o
In file included from /usr/local/include/ImageMagick-7/MagickWand/MagickWand.h:29:0,
from /home/joseph/Desktop/Magick/cBlocks/wandTest/main.c:1:
/usr/local/include/ImageMagick-7/MagickCore/magick-config.h:29:3: warning: #warning "you should set MAGICKCORE_QUANTUM_DEPTH to sensible default set it to configure time default" [-Wcpp]
# warning "you should set MAGICKCORE_QUANTUM_DEPTH to sensible default set it to configure time default"
^
/usr/local/include/ImageMagick-7/MagickCore/magick-config.h:30:3: warning: #warning "this is an obsolete behavior please fix your makefile" [-Wcpp]
# warning "this is an obsolete behavior please fix your makefile"
^
/usr/local/include/ImageMagick-7/MagickCore/magick-config.h:52:3: warning: #warning "you should set MAGICKCORE_HDRI_ENABLE to sensible default set it to configure time default" [-Wcpp]
# warning "you should set MAGICKCORE_HDRI_ENABLE to sensible default set it to configure time default"
^
/usr/local/include/ImageMagick-7/MagickCore/magick-config.h:53:3: warning: #warning "this is an obsolete behavior please fix yours makefile" [-Wcpp]
# warning "this is an obsolete behavior please fix yours makefile"
^
g++ -L/usr/local/lib -L/usr/local/lib -o bin/Debug/wandTest obj/Debug/main.o
obj/Debug/main.o: In function `main':
/home/joseph/Desktop/Magick/cBlocks/wandTest/main.c:7: undefined reference to `MagickWandGenesis'
/home/joseph/Desktop/Magick/cBlocks/wandTest/main.c:9: undefined reference to `NewMagickWand'
/home/joseph/Desktop/Magick/cBlocks/wandTest/main.c:11: undefined reference to `MagickReadImage'
/home/joseph/Desktop/Magick/cBlocks/wandTest/main.c:13: undefined reference to `MagickWriteImage'
/home/joseph/Desktop/Magick/cBlocks/wandTest/main.c:15: undefined reference to `DestroyMagickWand'
collect2: error: ld returned 1 exit status
Process terminated with status 1 (0 minute(s), 0 second(s))
5 error(s), 4 warning(s) (0 minute(s), 0 second(s))
Version: ImageMagick 7.0.2-2 Q16 x64 2016-07-03 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2015 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Visual C++: 190023918
Features: Debug Cipher DPC HDRI Modules OpenMP
Delegates (built-in): bzlib cairo flif freetype jng jp2 jpeg lcms lqr openexr pangocairo png ps rsvg tiff webp xml zlib