Cannot run sample programs

Hi.

I am trying to run the sample programs under Windows. I believe I have followed the linking instructions correctly, however I did have to include several DLL files in my working directory which was not specified in the instructions.

When I run the program it crashes with a generic "The application was unable to start correctly."

Any assistance in diagnosing this issue would be greatly appreciated.

Thank you.

You shouldn't need any

You shouldn't need any Graphviz files in the build directory. If the build works, you will have a demo.exe file.In the linking section of the properties, set Additional Dependencies to gvc.lib cgraph.lib cdt.lib, and set Additional Library Directories to C:\Program Files\Graphviz2.38\lib\release\lib if you are building the release version of a program. 

Unfortunately this issue is

Unfortunately this issue is still not resolved. I see another forum poster has experienced a similar problem.

There appears to be an

There appears to be an incompatibility between the stdio library used in the application and the stdio library used to build Graphviz. This is particularly puzzling as I am building the application with the same machine, visual studio version and settings used to build Graphviz.

The workaround is to avoid the functions in the Graphviz API that rely on stdio. The simplest way is to replace agread with agmemread, and gvRender with gvRenderFilename. You can also use the third parameter to agread to ensure compatible functions are used.

Please see if this works for you. If you have problems or questions, let me know.

Windows 8

I am using Windows 8 currently...

 

Cheers

dlls

Hi.

I am using visual studio 2013 to try and run the sample programs. When I am building the project it informs me it cannot find the required dlls (gvc.dll and cgraph.dll). The issue goes away when I include these files in my working directory. The program builds fine, but when it goes to run it fails with an application error. The error notification gives the error code 0xc0150002 which I believe is related to dlls as well. So maybe the issue is why is it having a problem with the dll files in the first place?

Where did you get the VS 2013 graphviz libraries?

Im stuck trying to get the DLLs to work at all (getting a crash in my app)  

 

We provide the project file

We provide the project file for only one of the sample programs: demo.c. You can use that as a starting point. Basically, you just need to tell visual studio to use the Graphviz include directory for header files by setting the Additional Include Directories field in the properties. For example, if Graphviz is installed in C:\Program Files\Graphviz2.38, you would set this to C:\Program Files\Graphviz2.38\include\graphviz. In the linking section of the properties, set Additional Dependencies to gvc.lib cgraph.lib cdt.lib, and set Additional Library Directories to C:\Program Files\Graphviz2.38\lib\release\lib if you are building the release version of a program. You shouldn't need any Graphviz files in the build directory. If the build works, you will have a demo.exe file. For it to run, you just have to make sure that the Graphviz bin directory is in your PATH. In that way, Windows will find gvc.dll and everything else related to Graphviz.

Now "unhandled exception.."

Thankyou, I had an error within my PATH. Now when I go to run a program, I get an Unhandled Exception. The error is: "Unhandled exception at 0x7743E3F2 (ntdll.dll) in demo.exe: 0xC0000005: Access violation writing location 0x00092144."

The code I am trying to run simply reads in a dot file, then outputs an xdot file, like thus:

~#include <gvc.h>
int main(int argc, char **argv) {
 GVC_t* gvc = gvContext();

 Agraph_t* g = agread("mygraph.dot", 0);

 gvLayout(gvc, g, "dot");

 gvRenderFilename(gvc, g, "xdot", "mygraph.xdot");
 gvFreeLayout(gvc, g);

 agclose(g);

 gvFreeContext(gvc);
}

Any help on this new issue would be greatly appreciated.

Cheers

 

Sorry it took me so long to

Sorry it took me so long to notice the problem. The first argument to agread() is a FILE*, not a char*. You first need to call fopen() or something similar to get a valid FILE*, and then pass that to agread. See http://www.graphviz.org/dot.demo/simple.c for an example.

Thank you for your reply. The

Thank you for your reply. The problem still persists unfortunately. The example simple.c causes the error. When I run simple.c, what arguments, if any, are required?

If you give it an argument,

If you give it an argument, it should be the name of a file containing a graph described in the DOT language. If no argument is given, it will read from stdin. The output is written to stdout.

We make no use of any library

We make no use of any library called ntdll. Doing a quick search, this appears to be a generic problem on Windows. See http://pcsupport.about.com/od/fixtheproblem/a/ntdlldll.htm or google "ntdll.dll" for more information.

What version of  Windows are you using?

Further information....

The issue is also present for Windows 7. Could there be some obscure set up step I have missed?

What extra dlls do you have

What extra dlls do you have to link in? You should only need the gvc, cgraph and cdt libraries. How are you building the program?

Recent comments