Compile Minipar programs on Windows

I was trying to compile the pdemo program comes with Minipar on both Linux and Windows XP. Minipar supplied a library file to be linked to your program, which is minipar.lib for Windows and libminipar.a for Linux.

I created a project using Visual Studio 2008. When building the project, many link errors showed up. Finally I found out that the Minipar library was compiled long time ago with Visual Studio 2003. In VS2008, the definitions of some standard library string functions have changed a little bit. (The difference is between “thiscall” and “_cdecl“.) So I have to find a copy of VS2003 and successfully compiled the pdemo program.

error LNK2001: unresolved external symbol “public: void __thiscall std::_String_base::_Xran(void)const ” (?_Xran@_String_base@std@@QBEXXZ) minipar.lib

Here are something to remember.
1. Use Multi-threaded option in Code Generation in the Project Property Page.
2. Add the following line to the beginning of your program.

#pragma comment(lib, “ws2_32.lib”)

Otherwise, you will have some link errors of _htonl, which look like

minipar.lib(strbufs.obj) : error LNK2019: unresolved external symbol _htonl@4 referenced in function “public: void __thiscall StrBufs::push_int(int const &)” (?push_int@StrBufs@@QAEXABH@Z)

If you would like to download the pdemo.exe, you can find it here. (Note, you still need the data files from Minipar to run this program.)

6 Responses to “Compile Minipar programs on Windows”

  1. Behrang Says:

    Hi Hao,

    I came across your weblog and see you have lots of experiences with minipar. I have just recently started my phd and am looking for a tcp/ip wrapper around minipar. I wonder if you have ever developed such a thing. can you plese let me know.

    cheers,

    Behrang

    • Hi Behrang,

      My current project uses Minipar to provide syntactic information for further analysis. But I didn’t make anything with tcp/ip. So you can go ahead and do it :)

      cheers!

  2. hi hao,,
    if u’re not object, i want to ask some questions…
    how if i want to link minipar with php?
    i want to get the output from this parser and work over it in my program on php. and how could i get minipar.lib?
    would you please give me some solution to solve it..
    thank you,, :)
    mee

  3. Student Says:

    Hi.
    Thanks!
    I had the same problems with Visual Studio.
    Again and again I just can’t believe how Microsoft does not care about backward compatibility.
    I worked with Linux – and had no problems.

    I suspected that the only option is to find and old compiler – and you indeed wrote that that is the correct way.
    Thanks and good luck.

    • I believe this is not only a problem for Microsoft and Visual Studio. As you can see from my post about compiling Minipar on Linux, it’s such a hassle if you have a newer version of gcc.

  4. Hao
    The link you have to the executable is broken – could you please provide a new link (or send me the exe direct)?
    It will save me much time in digging up an old copy of VS2003 & creating a VM for it.
    Thanks.
    Pete

Leave a Reply