Page 1 of 1

Building PCRE on windows.

Posted: Wed Oct 11, 2006 18:53
by granx
Hi, I wanted to build PCRE from scratch so that I knew what compile options were being used. I am working on Windows with Visual Studio and I found the PCRE doesn't have an official build solution for this compiler. However, they have some user contributions and I found this one quite helpful.

So, with PCRE finally built with MSVC, I tried to build CEGUI's SVN trunk, which is from last week sometime. I made sure the CEGUIBase project file would locate the dependencies' headers/libraries. I get this error upon linking CEGUIBase, release build:
unresolved external symbol _pcre_free referenced in function "public: void __thiscall CEGUI::RegexValidator::release(void)" (?release@RegexValidator@CEGUI@@QAEXXZ)

I looked for that 'pcre_free' symbol in the PCRE source code (pcre.h), and it is defined differently for builds that have the preprocessor macro "VPCOMPAT" defined, which appears to be for the Virtual Pascal support. Why am I seeing this link error when building CEGUI? Does it make sense to just add this preprocessor and rebuild PCRE?

Posted: Wed Oct 11, 2006 23:18
by granx
OK I fixed it.

First off, when building PCRE with the MSVC project files I mentioned, you need to add these preprocessor defines:
PCRE_DEFINITION
DLL_EXPORT
I believe '_WIN32; is already listed, but make sure it's in there too.

Next, when building CEGUI against PCRE, '_WIN32' must be defined, and 'PCRE_STATIC' must NOT be defined.

Actually, I just embarrassed myself. I realized all this work was for using PCRE as a DLL rather than a static library. The project files I found were building a DLL, which is probably most common, but CEGUI wants a static library built, so you'll need to tweak those project settings...well, that's what you'll need if you want to do the same. Sorry for the inconvenience.

Posted: Thu Oct 12, 2006 11:11
by lindquist