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.)
June 15, 2009 at 3:58 am
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
June 15, 2009 at 10:51 am
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!
June 24, 2009 at 12:18 am
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
July 27, 2009 at 6:06 am
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.
July 27, 2009 at 9:59 am
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.
October 22, 2009 at 4:43 am
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