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.)

13 thoughts on “Compile Minipar programs on Windows

  1. 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. 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

  5. I was checking MiniPar to do some research for my academic project. I was able to compile and run project in ubuntu. I have a one quick question for you. Dependency Triples that is mentioned in http://webdocs.cs.ualberta.ca/~lindek/downloads.htm I am not able to get results like this when I try to run ./pdemo -t option. I wanted to have a word count printed just like in Dependency Triples files. I will really appreciate your help if you help me solve my doubt.

  6. 3KS very much!!!
    I have been confused by this question for a whole night.
    I just changed the configuration of VS2008 again and again, but it did not work😦

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s