Hello,

I just downloaded the latest gd library, unziped it - i downloaded a dll version and a source code version. I have problems whit using it in my msvc application.

I will paste here the install specifications for visual c++ users :

[I]Instructions from the gd site :[/I]
How do I get gd?

Binaries (DLL for Windows programmers):

    * .ZIP File of DLL, Headers, Et Cetera

Source Code:

    * Gzipped Tar File (Unix)
    * .ZIP File of SOURCE CODE (Windows) 

How do I build gd?

Win32 DLL users: if you are using MSVC, use the provided batch file makemsvcimport.bat to make a bgd.lib import library corresponding to the provided bgd.dll. Copy bgd.dll to your application directory, or to your Windows sytem directory. In the settings of your MSVC project, you MUST choose the "multithreaded DLL" library option under "code generation." mingw32 and cygwin users can simply link with the provided libbgd.a stub library in order to use the DLL.

Building gd From the Source

In order to build gd, you must first unpack the archive you have downloaded.

[I]The following instructions  are taken from a different site :[/I]

Instructions 

1.Download the gd library for Windows from http://www.boutell.com/gd/ . The latest version is 2.0.33 (Windows dll). 
2.Unzip the archive to a suitable place. 
The package provides a dll and an import library for the MinGW compiler. To obtain an import library for the MSVC compiler run the makemsvcimport.bat batch file in a CLI with the correct environment settings for MSVC. 
3.In order to let cmake find the gd library files you need to set environment variables (best in batch file - see above), e.g. 
set GDLIBDIR=C:\DevZone\gdwin32
set CMAKE_INCLUDE_PATH=%GDLIBDIR%
set CMAKE_LIBRARY_PATH=%GDLIBDIR%
CMake should than be able to find the gd library and headers and the gd driver (png, gif, jpeg) will be automatically compiled into the library.

I dont' quite understand the latest step :how do i set the environment variables in the batch file ? how do i run the batch file ? just double clicking it ?

This is what i've done : i copied the unziped folder of the gd library in my application folder. i set the option for multitheread DLL, then i wrote "include gd.h" like in the samples in the "index" file in the gd library folder which i downloaded (this index file contains information about installing the library) .

when i compile i get the error : cannot open include file : "gd.h" :not such file or directory.
why? can you help me please? i haven't included libraries in visual c++ before. sorry, i am a newbie on this matter.
thanks in advance.

PS : and i also copied the library : bgd.dll to :windows/system folder on my computer.

I don't know how to use the provided batch file makemsvcimport.bat to make a bgd.lib import library corresponding to the provided bgd.dll. This is what i haven't done from the installation steps.

Don't i have to include some libraries in the project->link tab for example ? there is nothing on this fact written and i did this when i included the libraries for opengl for example. There are no .lib files on the archive i downloaded. :(
pls help me on this issue.

Don't i have to include some libraries in the project->link tab for example ?

Yes you have to, you will be using the bgd.lib import library for that purpose. At run-time, your program will then use the bgd.dll.

But first you really have to create the bgd.lib import library. Apparently the
makemsvcimport.bat file is the tool for that. Since you have MSVC installed, your environment variables (hopefully) are already correctly configured, so you should be able to simply just run the makemsvcimport.bat file (I'm not 100% sure though).
Anyway, try it (makemsvcimport.bat) out and see if it succeeds. If not, post more questions here ...

If your compiler is unable to find the "gd.h" header file, configure the MSVC's Tools/Options/Directories/Include files to have the directory where you have the "gd.h" header file.

Thanks:) now it compiles ok.(i included the path for the gd.h directory). how can i run this batch file : makemsvcimport.bat, from MSVC or from the command line ? i just cliked on it, and a black window appears very shortly, but the library hasn't been created.

It seems that you are working with an old version (2.0.33) of the library. I did not find any version that would contain the makemsvcimport.bat batch file.

I'd suggest that you download the

http://www.libgd.org/releases/gd-latest-win32.zip

That archive seems to come with a pre-built .lib file + the corresponding .dll, i.e. you don't have to build anything yourself.

I've used the gdwin32 library and i've run the batch file from the command line, it created the lib file for itself. i entered in the directory where the batch file was from the command line and run it and it created the lib like you said. i included the library in my project. i have some warning about a conflict with another library : defaultlib "MSVCRT" conflicts with use of other libs; use /NODEFAULTLIB:library ,but i hope it will be allright:)

If it won't work, i will use the library you provided. thank you for the link:)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.