Undefined reference to `_imp__agread'

Ok got it! And how do I compile now? Running make doesn’t work?

Install gcc with:

pacman -S --noconfirm --needed ${MINGW_PACKAGE_PREFIX}-gcc

I think it gives you make as well.

Otherwise use:

pacman -S --noconfirm --needed ${MINGW_PACKAGE_PREFIX}-make

You can find everyting you need though Packages - MSYS2 Packages and it’s so much better than Chocolatey for compiling if you’re used to using to a Linux system because it’s much more similar.

I reached my reply limit but it’s still me… I ran both commands but am still getting:
$ make
-bash: make: command not found

It did install though:
$ pacman -S --noconfirm --needed ${MINGW_PACKAGE_PREFIX}-make
warning: mingw-w64-x86_64-make-4.3-1 is up to date – skipping
there is nothing to do

@student I’ve upped you one level. Now you should be able to reply as yourself.

Restart mingw64.exe and try again.

This is how it looks for me:

~$ which make
/usr/bin/make
~$ ls -l /usr/bin/make
-rwxr-xr-x 1 magja magja 201124 Jan 23  2020 /usr/bin/make

Sadly I don’t have that…
$ which make
which: no make in (/mingw64/bin:/usr/local/bin:/usr/bin:/bin:/c/Windows/System32:/c/Windows:/c/Windows/System32/Wbem:/c/Windows/System32/WindowsPowerShell/v1.0/:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl)

Are you in the mingw64 bash when you do that? You shall not do it in GitBash.

I still can’t reply as myself. And yes, I am in mingw64 bash. Here is the window that I see:

Thanks!

You should be able to see where this files are with ~$ pacman -Q -l make

This is very weird but…
$ pacman -Q -l make
error: package ‘make’ was not found

Ok. Try installing with:

 pacman -S make

Yes, that worked, thanks! But, now I have no path to win_bison anymore… I have to fix these errors before I can compile. Is accessing Bison and Flex different now that I am using Mingw64? I am assuming I need to redownload them, so would you have a command for that, please?

You can get inspiration from ci/mingw-build.sh · main · graphviz / graphviz · GitLab. It’s those packages we use when building Graphviz itself, but you don’t need all of them.

Sorry I can’t give more direct help. I learnt most of this myself a couple of months ago. Windows is a horrible environment to work in, but MinGW make life somewhat easier.

Wow! It compiled! Thank you so much for your help.

I do have a follow-up question, the code didn’t actually do what I intended it to do. It did not read the .dot file and turn it into a graph depiction in .png format.

Here is the code again:

void generate_graph(){
    FILE *fp;
    fp = fopen("C:/Users/claud/Documents/UW/4A/Roseseed/test.dot", "w+");
    fputs("digraph ERD {\n", fp);
    fputs("graph [   rankdir = \"LR\" ];\n", fp);
    fputs("ranksep=2;\n", fp);
    fputs("\"SCOTT.DEPT\" [ label=\"<SCOTT.DEPT> SCOTT.DEPT|<PK_DEPT>DEPTNO \\l |DNAME \\l LOC \\l \" shape = \"record\" ];\n", fp);
    fputs("\"SCOTT.EMP\" [ label=\"<SCOTT.EMP> SCOTT.EMP|<FK_DEPTNO>DEPTNO \\l |EMPNO \\l ENAME \\l JOB \\l MGR \\l STARTDATE \\l SAL \\l COMM \\l \" shape = \"record\" ];\n", fp);
    fputs("\"SCOTT.DEPT\":\"PK_DEPT\"->\"SCOTT.EMP\":\"FK_DEPTNO\" [arrowhead = crow];}\n", fp);
    fclose(fp);

    export_graph();    
}

void export_graph(){
    FILE *fp;
    fp = fopen("C:/Users/claud/Documents/UW/4A/Roseseed/test.dot", "r");
    Agraph_t *g;
    g = agread(fp, 0);
    GVC_t *gvc;
    gvc = gvContext();
    gvLayout(gvc, g, "dot");
    gvRender(gvc, g, "png", 
        fopen("C:/Users/claud/Documents/UW/4A/Roseseed/test.png", "w"));
    gvFreeLayout(gvc, g);
    agclose(g);
}

Does that look right? Again thank you so much for your help, I really appreciate it.

It looks kind of right, but it’s hard to tell without running it. What happened? Can you post test.dot so I can try it?

Yes, this is what is in it:

digraph ERD {
graph [   rankdir = "LR" ];
ranksep=2;
"SCOTT.DEPT" [ label="<SCOTT.DEPT> SCOTT.DEPT|<PK_DEPT>DEPTNO \l |DNAME \l LOC \l " shape = "record" ];
"SCOTT.EMP" [ label="<SCOTT.EMP> SCOTT.EMP|<FK_DEPTNO>DEPTNO \l |EMPNO \l ENAME \l JOB \l MGR \l STARTDATE \l SAL \l COMM \l " shape = "record" ];
"SCOTT.DEPT":"PK_DEPT"->"SCOTT.EMP":"FK_DEPTNO" [arrowhead = crow];}

My first function writes this to that file, which works. But the second function doesn’t seem to work.