Solved

How to compile only pcre_exec.c in Visual C?

Posted on 2009-06-29
17
652 Views
Last Modified: 2013-11-27
Hi,

Is there any way of compiling pcre_exec without getting any error or warning messages?
0
Comment
Question by:tigerman82
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 4
  • 4
  • +1
17 Comments
 
LVL 53

Expert Comment

by:Infinity08
ID: 24735751
Probably. But without seeing the code or knowing the error messages you get, I can't really say anything more ...
0
 

Author Comment

by:tigerman82
ID: 24735779
Hi,

Attached is the error messages I get
1>------ Build started: Project: test pcre_exec, Configuration: Debug Win32 ------
1>Compiling...
1>pcre_exec.c
1>c:\test pcre_exec\pcre_exec.c(699) : error C2065: 'LINK_SIZE' : undeclared identifier
1>c:\test pcre_exec\pcre_exec.c(699) : error C2065: 'LINK_SIZE' : undeclared identifier
1>c:\test pcre_exec\pcre_exec.c(726) : warning C4013: 'GET' undefined; assuming extern returning int
1>c:\test pcre_exec\pcre_exec.c(801) : error C2065: 'LINK_SIZE' : undeclared identifier
1>c:\test pcre_exec\pcre_exec.c(807) : error C2065: 'LINK_SIZE' : undeclared identifier
1>c:\test pcre_exec\pcre_exec.c(813) : error C2065: 'LINK_SIZE' : undeclared identifier
1>c:\test pcre_exec\pcre_exec.c(814) : error C2065: 'LINK_SIZE' : undeclared identifier
1>c:\test pcre_exec\pcre_exec.c(824) : error C2065: 'LINK_SIZE' : undeclared identifier
1>c:\test pcre_exec\pcre_exec.c(830) : error C2065: 'LINK_SIZE' : undeclared identifier
1>c:\test pcre_exec\pcre_exec.c(830) : error C2065: 'LINK_SIZE' : undeclared identifier
1>c:\test pcre_exec\pcre_exec.c(838) : error C2065: 'LINK_SIZE' : undeclared identifier
1>c:\test pcre_exec\pcre_exec.c(838) : error C2065: 'LINK_SIZE' : undeclared identifier
1>c:\test pcre_exec\pcre_exec.c(856) : error C2065: 'LINK_SIZE' : undeclared identifier
1>c:\test pcre_exec\pcre_exec.c(860) : error C2065: 'LINK_SIZE' : undeclared identifier
1>c:\test pcre_exec\pcre_exec.c(860) : error C2065: 'LINK_SIZE' : undeclared identifier
1>c:\test pcre_exec\pcre_exec.c(881) : error C2065: 'LINK_SIZE' : undeclared identifier
1>c:\test pcre_exec\pcre_exec.c(895) : error C2065: 'LINK_SIZE' : undeclared identifier
1>c:\test pcre_exec\pcre_exec.c(947) : error C2065: 'LINK_SIZE' : undeclared identifier
1>c:\test pcre_exec\pcre_exec.c(963) : error C2065: 'LINK_SIZE' : undeclared identifier
1>c:\test pcre_exec\pcre_exec.c(974) : error C2065: 'LINK_SIZE' : undeclared identifier
1>c:\test pcre_exec\pcre_exec.c(983) : error C2065: 'LINK_SIZE' : undeclared identifier
1>c:\test pcre_exec\pcre_exec.c(1015) : error C2065: 'LINK_SIZE' : undeclared identifier
1>c:\test pcre_exec\pcre_exec.c(1034) : error C2065: 'LINK_SIZE' : undeclared identifier
1>c:\test pcre_exec\pcre_exec.c(1041) : error C2065: 'LINK_SIZE' : undeclared identifier
1>c:\test pcre_exec\pcre_exec.c(1067) : error C2065: 'LINK_SIZE' : undeclared identifier
1>c:\test pcre_exec\pcre_exec.c(1067) : error C2065: 'LINK_SIZE' : undeclared identifier
1>c:\test pcre_exec\pcre_exec.c(1076) : error C2065: 'LINK_SIZE' : undeclared identifier
1>c:\test pcre_exec\pcre_exec.c(1149) : error C2065: 'LINK_SIZE' : undeclared identifier
1>c:\test pcre_exec\pcre_exec.c(1176) : error C2065: 'LINK_SIZE' : undeclared identifier
1>c:\test pcre_exec\pcre_exec.c(1186) : error C2065: 'LINK_SIZE' : undeclared identifier
1>c:\test pcre_exec\pcre_exec.c(1194) : error C2065: 'LINK_SIZE' : undeclared identifier
1>c:\test pcre_exec\pcre_exec.c(1204) : error C2065: 'LINK_SIZE' : undeclared identifier
1>c:\test pcre_exec\pcre_exec.c(1229) : error C2065: 'LINK_SIZE' : undeclared identifier
1>c:\test pcre_exec\pcre_exec.c(1237) : error C2065: 'LINK_SIZE' : undeclared identifier
1>c:\test pcre_exec\pcre_exec.c(1247) : error C2065: 'LINK_SIZE' : undeclared identifier
1>c:\test pcre_exec\pcre_exec.c(1290) : error C2065: 'LINK_SIZE' : undeclared identifier
1>c:\test pcre_exec\pcre_exec.c(1290) : error C2065: 'LINK_SIZE' : undeclared identifier
1>c:\test pcre_exec\pcre_exec.c(1338) : error C2065: 'LINK_SIZE' : undeclared identifier
1>c:\test pcre_exec\pcre_exec.c(1351) : error C2065: 'LINK_SIZE' : undeclared identifier
1>c:\test pcre_exec\pcre_exec.c(1365) : error C2065: 'LINK_SIZE' : undeclared identifier
1>c:\test pcre_exec\pcre_exec.c(4473) : error C2065: 'MATCH_LIMIT' : undeclared identifier
1>c:\test pcre_exec\pcre_exec.c(4474) : error C2065: 'MATCH_LIMIT_RECURSION' : undeclared identifier
1>c:\test pcre_exec\pcre_exec.c(4576) : error C2065: 'NEWLINE' : undeclared identifier
1>Build log was saved at "file://c:\Test pcre_exec\test pcre_exec\Debug\BuildLog.htm"
1>test pcre_exec - 42 error(s), 1 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Open in new window

0
 
LVL 53

Expert Comment

by:Infinity08
ID: 24735811
For which code ?

Where is LINK_SIZE declared ? (same for the others)
0
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 
LVL 9

Expert Comment

by:masheik
ID: 24735839
You are not declared LINK_SIZE corrected
0
 
LVL 9

Expert Comment

by:masheik
ID: 24735853
A variable's type should  be specified  before it can be used.
0
 

Author Comment

by:tigerman82
ID: 24735885
ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/

this is where the original code is, which is proven to work.  All I am trying to do is to compile only the pcre_exec.c file and to find out which other header files are attached to it.
0
 
LVL 40

Expert Comment

by:evilrix
ID: 24735936
LINK_SIZE is a macro that needs to be defined to tell PCRE how big its regular expression can be.

As the doc out the header says below, this should be set to 2 by default; however, you can override this using -D on the compilers command line.
/* PCRE keeps offsets in its compiled code as 2-byte quantities by default.
   These are used, for example, to link from the start of a subpattern to its
   alternatives and its end. The use of 2 bytes per offset limits the size of the
   compiled regex to around 64K, which is big enough for almost everybody.
   However, I received a request for an even bigger limit. For this reason, and
   also to make the code easier to maintain, the storing and loading of offsets
   from the byte string is now handled by the macros that are defined here.
  
   The macros are controlled by the value of LINK_SIZE. This defaults to 2 in
   the config.h file, but can be overridden by using -D on the command line. This
   is automated on Unix systems via the "configure" command. */

Open in new window

0
 
LVL 53

Expert Comment

by:Infinity08
ID: 24735939
This is a library - why do you want to compile only part of it ?

If you compile the whole library, you can make use of that one part very easily by just linking to the library, and calling the method you need. Don't go through the trouble of getting one file to compile separately.
0
 
LVL 40

Expert Comment

by:evilrix
ID: 24735969
BTW: I see you're compiling this in Windows? I'd strongly suggest you download the official PCRE7.9 release and build it using CMake, I know this to build properly out of the box in both VC2005 and VC2008 because I built both only last week.

Maybe CMake will make this simpler for you. It's a make system that will generate make files, including Solutions and Projects for Visual Studio. I found a link that explains how to use it to create a solution for PCRE.

http://vcs.pcre.org/viewvc/code/trunk/NON-UNIX-USE?revision=306&pathrev=359

BUILDING PCRE WITH CMAKE

CMake is an alternative build facility that can be used instead of the
traditional Unix "configure". CMake version 2.4.7 supports Borland makefiles,
MinGW makefiles, MSYS makefiles, NMake makefiles, UNIX makefiles, Visual Studio
6, Visual Studio 7, Visual Studio 8, and Watcom W8. The following instructions
were contributed by a PCRE user.

1. Download CMake 2.4.7 or above from http://www.cmake.org/, install and ensure
   that cmake\bin is on your path.

2. Unzip (retaining folder structure) the PCRE source tree into a source
   directory such as C:\pcre.

3. Create a new, empty build directory: C:\pcre\build\

4. Run CMakeSetup from the Shell envirornment of your build tool, e.g., Msys
   for Msys/MinGW or Visual Studio Command Prompt for VC/VC++

5. Enter C:\pcre\pcre-xx and C:\pcre\build for the source and build
   directories, respectively

6. Hit the "Configure" button.

7. Select the particular IDE / build tool that you are using (Visual Studio,
   MSYS makefiles, MinGW makefiles, etc.)

8. The GUI will then list several configuration options. This is where you can
   enable UTF-8 support, etc.

9. Hit "Configure" again. The adjacent "OK" button should now be active.

10. Hit "OK".

11. The build directory should now contain a usable build system, be it a
    solution file for Visual Studio, makefiles for MinGW, etc.

0
 
LVL 9

Expert Comment

by:masheik
ID: 24735987
you can create a new visual studio project by adding all .c , .h files ,and from that visual studio project file prce_exec.c you can find what are all files linked .
0
 
LVL 40

Expert Comment

by:evilrix
ID: 24736002
>> you can create a new visual studio project by adding all .c , .h files
It's really not necessary to do this since the standard solution, generated using cmake, separates everything into discrete projects so you can control what you need to build using the solution configuration manager.
0
 

Author Comment

by:tigerman82
ID: 24736027
Is there anyway I can do this straight in Visual Studio without having to use CMake?  I am trying to find how pcre_exec is linked to other files so that I can extract this processing engine for me to do further analysis.
0
 
LVL 40

Accepted Solution

by:
evilrix earned 500 total points
ID: 24736058
>> Is there anyway I can do this straight in Visual Studio without having to use CMake?
Well, unless you want tp spend hours trying to figure out all the various different configuration settings, no... but it take about 30 seconds to do it using CMake so why not just do it that way (which is the correct way)?
0
 

Author Comment

by:tigerman82
ID: 24736097
Is CMake going to change the original codes in any way because that would actually defeat the purpose.
0
 
LVL 40

Expert Comment

by:evilrix
ID: 24736109
>> Is CMake going to change the original codes in any way because that would actually defeat the purpose.
Not to the best of my knowledge... it just generate solutions and projects. To be 100% sure take a copy of your original, generate using cmake and then use something like WinMerge to diff (WinMerge will diff whole directory trees).
0
 
LVL 9

Expert Comment

by:masheik
ID: 24736141
you can create a new project with out using cmake and add all files and find the links
0
 
LVL 40

Expert Comment

by:evilrix
ID: 24736171
>> you can create a new project with out using cmake and add all files and find the links
But there are many config settings that won't be set will need to be figured out (which is what the original problem is all about!). By generating the CMake project (which is the correct and official way to do this) you'll have a template to work from, which will include all the settings you need to know about. Why guess where it's already been done for you?
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use while-loops in the C programming language.
The goal of this video is to provide viewers with basic examples to understand opening and reading files in the C programming language.

729 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question