Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ Development ➜ PCRE-related compiler errors

PCRE-related compiler errors

It is now over 60 days since the last post. This thread is closed.     Refresh page


Pages: 1 2  

Posted by Silverwind   (13 posts)  Bio
Date Thu 18 Apr 2013 10:43 PM (UTC)
Message
Working with source for 4.90, attempting to compile with MSVC++ 6.0 with service pack 6.0 installed, the compiler tosses the following errors:

Utilities.cpp
[...]mushclient\pcre\pcre_internal.h(2327) : error C2371: 'real_pcre' : redefinition; different basic types
        [...]mushclient\pcre\pcre.h(309) : see declaration of 'real_pcre'
[...]mushclient\pcre\pcre_internal.h(2328) : error C2371: 'real_pcre16' : redefinition; different basic types
        [...]mushclient\pcre\pcre.h(312) : see declaration of 'real_pcre16'
[...]mushclient\pcre\pcre_internal.h(2351) : error C2027: use of undefined type 'real_pcre'
        [...]mushclient\pcre\pcre.h(309) : see declaration of 'real_pcre'
[...]mushclient\Utilities.cpp(2590) : error C2027: use of undefined type 'real_pcre'
        [...]mushclient\pcre\pcre.h(309) : see declaration of 'real_pcre'
[...]mushclient\Utilities.cpp(2590) : error C2227: left of '->options' must point to class/struct/union
lua_scripting.cpp
[...]mushclient\scripting\..\pcre\pcre_internal.h(2327) : error C2371: 'real_pcre' : redefinition; different basic types
        [...]mushclient\pcre\pcre.h(309) : see declaration of 'real_pcre'
[...]mushclient\scripting\..\pcre\pcre_internal.h(2328) : error C2371: 'real_pcre16' : redefinition; different basic types
        [...]mushclient\pcre\pcre.h(312) : see declaration of 'real_pcre16'
[...]mushclient\scripting\..\pcre\pcre_internal.h(2351) : error C2027: use of undefined type 'real_pcre'
        [...]mushclient\pcre\pcre.h(309) : see declaration of 'real_pcre'
[...]mushclient\scripting\lua_scripting.cpp(518) : error C2027: use of undefined type 'real_pcre'
        [...]mushclient\pcre\pcre.h(309) : see declaration of 'real_pcre'
[...]mushclient\scripting\lua_scripting.cpp(518) : error C2227: left of '->options' must point to class/struct/union
Generating Code...
Error executing cl.exe.

MUSHclient.exe - 10 error(s), 0 warning(s)
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #1 on Fri 19 Apr 2013 10:51 PM (UTC)
Message
I seem to recall getting this a year or so ago but can't remember how I fixed it. I note that:


#if defined COMPILE_PCRE8
#define REAL_PCRE real_pcre
#elif defined COMPILE_PCRE16
#define REAL_PCRE real_pcre16
#elif defined COMPILE_PCRE32
#define REAL_PCRE real_pcre32
#endif


Try changing "real_pcre" to "REAL_PCRE", see if that helps.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Silverwind   (13 posts)  Bio
Date Reply #2 on Sun 21 Apr 2013 06:21 AM (UTC)
Message
That didn't work. It still throws the exact same errors on all the same lines.
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #3 on Sun 21 Apr 2013 10:08 AM (UTC)
Message
I'm using Visual C++ 6.0.

It should compile OK.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #4 on Sun 21 Apr 2013 10:09 AM (UTC)
Message
Which version of PCRE do you have?

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Silverwind   (13 posts)  Bio
Date Reply #5 on Sun 21 Apr 2013 09:47 PM (UTC)
Message
The one from the readme in the PCRE directory for the source:

ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.32.zip
Top

Posted by Silverwind   (13 posts)  Bio
Date Reply #6 on Sat 11 May 2013 06:13 PM (UTC)
Message
Any further ideas for this? I don't know what I could be doing wrong here. I've checked and doublechecked all the instructions in the Mushclient source package.
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #7 on Mon 13 May 2013 12:21 PM (UTC)

Amended on Mon 13 May 2013 12:23 PM (UTC) by Nick Gammon

Message
I did a "diff" on the changes between what I actually compiled with, and the 8.32 release:


diff -c /c/Documents and Settings/Owner/Desktop/pcre-8.32/pcre_compile.c pcre/pcre_compile.c
*** /c/Documents and Settings/Owner/Desktop/pcre-8.32/pcre_compile.c	Sun Nov 11 21:23:00 2012
--- pcre/pcre_compile.c	Wed Feb  6 08:49:15 2013
***************
*** 1,3 ****
--- 1,10 ----
+ #pragma warning( disable : 4018)  // '<' : signed/unsigned mismatch
+ #pragma warning( disable : 4127)  // conditional expression is constant
+ #pragma warning( disable : 4244)  // conversion from 'int' to 'unsigned short', possible loss of data
+ #pragma warning( disable : 4701)  // local variable 'othercase' may be used without having been initialized
+ #pragma warning( disable : 4702)  // unreachable code
+ 
+ 
  /*************************************************
  *      Perl-Compatible Regular Expressions       *
  *************************************************/
diff -c /c/Documents and Settings/Owner/Desktop/pcre-8.32/pcre_dfa_exec.c pcre/pcre_dfa_exec.c
*** /c/Documents and Settings/Owner/Desktop/pcre-8.32/pcre_dfa_exec.c	Sun Nov 11 21:23:00 2012
--- pcre/pcre_dfa_exec.c	Wed Feb  6 09:11:11 2013
***************
*** 1,3 ****
--- 1,6 ----
+ #pragma warning( disable : 4244)  // conversion from 'int' to 'unsigned short', possible loss of data
+ #pragma warning( disable : 4146)  // unary minus operator applied to unsigned type, result still unsigned
+ 
  /*************************************************
  *      Perl-Compatible Regular Expressions       *
  *************************************************/
diff -c /c/Documents and Settings/Owner/Desktop/pcre-8.32/pcre_exec.c pcre/pcre_exec.c
*** /c/Documents and Settings/Owner/Desktop/pcre-8.32/pcre_exec.c	Sun Nov 11 21:23:00 2012
--- pcre/pcre_exec.c	Wed Feb  6 08:50:10 2013
***************
*** 1,3 ****
--- 1,6 ----
+ #pragma warning( disable : 4127)  // conditional expression is constant
+ #pragma warning( disable : 4244)  // conversion from 'int' to 'unsigned short', possible loss of data
+ 
  /*************************************************
  *      Perl-Compatible Regular Expressions       *
  *************************************************/
diff -c /c/Documents and Settings/Owner/Desktop/pcre-8.32/pcre_maketables.c pcre/pcre_maketables.c
*** /c/Documents and Settings/Owner/Desktop/pcre-8.32/pcre_maketables.c	Wed Oct 17 17:14:00 2012
--- pcre/pcre_maketables.c	Wed Feb  6 08:49:38 2013
***************
*** 1,3 ****
--- 1,5 ----
+ #pragma warning( disable : 4244)  // conversion from 'int' to 'unsigned short', possible loss of data
+ 
  /*************************************************
  *      Perl-Compatible Regular Expressions       *
  *************************************************/
diff -c /c/Documents and Settings/Owner/Desktop/pcre-8.32/pcre_ord2utf8.c pcre/pcre_ord2utf8.c
*** /c/Documents and Settings/Owner/Desktop/pcre-8.32/pcre_ord2utf8.c	Sun Nov 11 21:23:00 2012
--- pcre/pcre_ord2utf8.c	Wed Feb  6 08:49:44 2013
***************
*** 1,3 ****
--- 1,5 ----
+ #pragma warning( disable : 4244)  // conversion from 'int' to 'unsigned short', possible loss of data
+ 
  /*************************************************
  *      Perl-Compatible Regular Expressions       *
  *************************************************/
diff -c /c/Documents and Settings/Owner/Desktop/pcre-8.32/pcre_refcount.c pcre/pcre_refcount.c
*** /c/Documents and Settings/Owner/Desktop/pcre-8.32/pcre_refcount.c	Wed Oct 17 17:14:00 2012
--- pcre/pcre_refcount.c	Wed Feb  6 08:49:50 2013
***************
*** 1,3 ****
--- 1,5 ----
+ #pragma warning( disable : 4244)  // conversion from 'int' to 'unsigned short', possible loss of data
+ 
  /*************************************************
  *      Perl-Compatible Regular Expressions       *
  *************************************************/
diff -c /c/Documents and Settings/Owner/Desktop/pcre-8.32/pcre_study.c pcre/pcre_study.c
*** /c/Documents and Settings/Owner/Desktop/pcre-8.32/pcre_study.c	Sun Nov 11 21:23:00 2012
--- pcre/pcre_study.c	Wed Feb  6 08:49:55 2013
***************
*** 1,3 ****
--- 1,5 ----
+ #pragma warning( disable : 4244)  // conversion from 'int' to 'unsigned short', possible loss of data
+ 
  /*************************************************
  *      Perl-Compatible Regular Expressions       *
  *************************************************/


Nothing looks really relevant.

The only thing I can think of is the precompiled headers. Select all the PCRE files in the IDE and make sure that you have "Not using precompiled headers" selected.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Silverwind   (13 posts)  Bio
Date Reply #8 on Tue 14 May 2013 04:46 PM (UTC)
Message
Those are all set up as they should be. :/ It confuses the hell out of me that files straight from the package are conflicting with /themselves/. Is there anything else that could be relevant here? I'm using MSVC++ 6.0 with Service Pack 6 on 64-bit Windows 7.
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #9 on Wed 15 May 2013 10:23 PM (UTC)
Message
I'm confused too because that is the compiler I have, and if you have the 4.90 source that is what I am using.

Can you confirm that in Utilities.cpp around line 2590 you have this exact code?


typedef unsigned char uschar;

int
njg_get_first_set(const pcre *code, const char *stringname, const int *ovector)
{
const real_pcre *re = (const real_pcre *)code;
int entrysize;
char *first, *last;
uschar *entry;
if ((re->options & (PCRE_DUPNAMES | PCRE_JCHANGED)) == 0)
  return pcre_get_stringnumber(code, stringname);
entrysize = pcre_get_stringtable_entries(code, stringname, &first, &last);
if (entrysize <= 0) return entrysize;
for (entry = (uschar *)first; entry <= (uschar *)last; entry += entrysize)
  {
  int n = (entry[0] << 8) + entry[1];
  if (ovector[n*2] >= 0) return n;
  }
return (first[0] << 8) + first[1];
}


- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #10 on Wed 15 May 2013 10:25 PM (UTC)
Message
Also did you do this step in the "readme" for the PCRE part of the project?

Quote:


(Note that config.h is part of the git repository)

4. Rename pcre_chartables.c.dist as pcre_chartables.c
Rename pcre.h.generic as pcre.h


- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Silverwind   (13 posts)  Bio
Date Reply #11 on Wed 15 May 2013 10:38 PM (UTC)
Message
Check and doublecheck. The compiler isn't even producing an error within utilities.cpp itself, it's a conflict between pcre.h and pcre_internal.h, both of which come from the PCRE package. I don't understand how with the same compiler, using the same sources and project files that this could be going on.
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #12 on Fri 17 May 2013 05:48 AM (UTC)

Amended on Fri 17 May 2013 05:49 AM (UTC) by Nick Gammon

Message
It is here:


[...]mushclient\Utilities.cpp(2590) : error C2027: use of undefined type 'real_pcre'
        [...]mushclient\pcre\pcre.h(309) : see declaration of 'real_pcre'


It says it is undefined, and then points to pcre.h line 309:


struct real_pcre8_or_16;                 /* declaration; the definition is private  */


OK, so that is a forwards declaration. However the real declaration seems to be at line 2309 of pcre_internal.h.


typedef struct real_pcre8_or_16 {
  pcre_uint32 magic_number;
  pcre_uint32 size;               /* Total that was malloced */
  pcre_uint32 options;            /* Public options */
  pcre_uint16 flags;              /* Private flags */
  pcre_uint16 max_lookbehind;     /* Longest lookbehind (characters) */
  pcre_uint16 top_bracket;        /* Highest numbered group */
  pcre_uint16 top_backref;        /* Highest numbered back reference */
  pcre_uint16 first_char;         /* Starting character */
  pcre_uint16 req_char;           /* This character must be seen */
  pcre_uint16 name_table_offset;  /* Offset to name table that follows */
  pcre_uint16 name_entry_size;    /* Size of any name items */
  pcre_uint16 name_count;         /* Number of name items */
  pcre_uint16 ref_count;          /* Reference count */
  const pcre_uint8 *tables;       /* Pointer to tables or NULL for std */
  const pcre_uint8 *nullpad;      /* NULL padding */
} real_pcre8_or_16;


- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #13 on Fri 17 May 2013 05:56 AM (UTC)

Amended on Fri 17 May 2013 05:57 AM (UTC) by Nick Gammon

Message
Try setting this define in project properties, if you haven't already:



For each of the .c file in the PCRE part, as highlighted (there would be a few more underneath).

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Silverwind   (13 posts)  Bio
Date Reply #14 on Sat 18 May 2013 12:56 AM (UTC)
Message
Already set across the board. :( I'm using the project/workspace files from the source package.
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


65,334 views.

This is page 1, subject is 2 pages long: 1 2  [Next page]

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.