My favorites | Sign in
Google
                
New issue | Search
for
| Advanced search | Search tips
Issue 36: HOWTO: compliation fails due to mismatched linkage
1 person starred this issue and may be notified of changes. Back to list
Status:  Fixed
Owner:  theraysmith
Closed:  Jul 2007
Type-Defect
Priority-Medium


Sign in to add a comment
 
Reported by z23r751, Jun 16, 2007
someone else posted this fix somewhere, which i found at 4am. can't find it
again now, in the daylight, so here it is again:
  	
PLATFORMS: Various, including opensuse 10.2

PROBLEM: after successful ./configure, make fails due to C/C++ conflicts
such as:

........ previous declaration of ‘.....’ with ‘C++’ linkage
........ conflicts with new declaration with ‘C’ linkage

VERSIONS: various, including tesseract-1.04b.tar.gz

SOLUTION: simple edits two header files

11111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111

# diff -C 3 ./cutil/globals.h~ ./cutil/globals.h
*** ./cutil/globals.h~  2007-05-15 20:13:26.000000000 -0500
--- ./cutil/globals.h   2007-06-16 04:27:42.000000000 -0500
***************
*** 45,53 ****
  extern int debugs[MAXPROC];      /*debug flags */
  extern int plots[MAXPROC];       /*plot flags */
  extern int corners[4];           /*corners of scan window */
  extern int optind;               /*option index */
  extern char *optarg;             /*option argument */
!                                  /*image file name */
  extern char imagefile[FILENAMESIZE];
                                   /* main directory */
  extern char directory[FILENAMESIZE];
--- 45,58 ----
  extern int debugs[MAXPROC];      /*debug flags */
  extern int plots[MAXPROC];       /*plot flags */
  extern int corners[4];           /*corners of scan window */
+ #ifdef __cplusplus
+ extern "C" {
+ #endif
  extern int optind;               /*option index */
  extern char *optarg;             /*option argument */
! #ifdef __cplusplus
! }
! #endif                               /*image file name */
  extern char imagefile[FILENAMESIZE];
                                   /* main directory */
  extern char directory[FILENAMESIZE];

2222222222222222222222222222222222222222222222222222222222222222
2222222222222222222222222222222222222222222222222222222222222222

# diff -C 3 ./cutil/tordvars.h~ ./cutil/tordvars.h
*** ./cutil/tordvars.h~ 2007-05-16 16:33:53.000000000 -0500
--- ./cutil/tordvars.h  2007-06-16 04:25:43.000000000 -0500
***************
*** 39,44 ****
--- 39,46 ----
  extern FILE *correct_fp;                    //correct text
  extern FILE *matcher_fp;
  
+ extern "C"
+ {
  extern int blob_skip;                       /* Skip to next selection */
  extern int num_word_choices;                /* How many words to keep */
  extern int similarity_enable;               /* Switch for Similarity */
***************
*** 50,55 ****
--- 52,58 ----
  extern int show_bold;                       /* Use bold text */
  extern int display_text;                    /* Show word text */
  extern int display_blocks;                  /* Show word as boxes */
+ }
  
  extern float overlap_threshold;             /* Overlap Threshold */
  extern float certainty_threshold;           /* When to quit looking */





Comment 1 by bersace, Jun 28, 2007
Hi,

Thos patches fixed build of Tesseract SVN (r72) on Ubuntu Gutsy Gibbon x86. Could you
please commit them ? I attached the diffs (apply with patch -p0) in the case it might
help you. (It's just a copy/past).

Regards.
globals-h-extern-c.diff
1.1 KB Download
tordvars-h-extern-c.diff
900 bytes Download
Comment 2 by z23r751, Jun 28, 2007
hi bersace, perhaps someone on the development team will commit them (i'm not part of
the development team).  glad my little help message helped. 
Comment 3 by theraysmith, Jul 06, 2007
This will be fixed properly in v2.0
Status: Started
Owner: theraysmith
Comment 4 by theraysmith, Jul 18, 2007
(No comment was entered for this change.)
Status: Fixed
Comment 5 by z23r751, Jul 18, 2007
excellent, thks!
Sign in to add a comment