怎么介绍?
分类:
2008-09-21 17:23:00
GRETA gives you all the power of PERL 5 regular expressions in your C++ applications. This is the of GRETA. Today, we will discuss neither nor template classes in the GRETA library, because you can get familiar with them at the GRETA homepage. Here, I will explain how to add and build the GRETA library in Visual C++, step by step.
Download GRETA's source code from GRETA homepage. For example: GRETA 2.6.4 for VC6, you will get 'greta-2.6.4-vc6.zip'. Or, you can . Please do not download the *.lib file for GRETA (such as greta.lib etc.). You may find GRETA in the *.lib file from Microsoft. But greta.lib may not satisfy your needs. It may generate link errors.
GRETA library has six program files:
Create a new 'Win32 Static Library' project for GRETA in your workspace:
main()
function. Change #include "regexpr2.h"
to #include "..\greta\regexpr2.h"
.
These examples are in the HTML file of the GRETA zip package. Select
'Main' project as the active project, then compile and run the project:
This is the final result that you get:
Now, we have successfully finished the project with GRETA. [].
If your project uses Unicode or your main project is DLL type, please go on with the following.
If your project (which uses GRETA) is of Unicode version, you must make the GRETA project to be of Unicode version. For example:
You will get 'Unicode Debug' and 'Unicode Release' configurations for both GRETA and your main project.
In many cases, when your main project is DLL type, you must make sure that GRETA uses the same runtime library as your main project, or you will get a link error.
Q: Why do we need to download greta.lib and why the downloaded greta.lib generates link error?
A: This is because of "Unicode version" and "Runtime library". Because it is not known whether the downloaded greta.lib is of Unicode version, and it is also not known which runtime library the downloaded greta.lib uses, so it may generate link errors.