Name collisions in several files when cross-compiling with CodeSourcery (Feature #221)


Added by hype blade about 4 years ago. Updated about 4 years ago.


Status:Done Start date:
Priority:High Due date:
Assignee:- % Done:

0%

Category:build/install
Target version:-
Difficulty: Pull request:

Description

Hi Vadim,
I did some more research concerning the naming collisions between OpenCV2.0 and the CodeSourcery cross-compiler for ARM (none-eabi). The files that are involved in this are:

- cxcore/cxlapack.cpp
- cxcore/cxmatmul.cpp
- cv/cvcalibration.cpp
- cv/cvlkpyramid.cpp
- cv/cvlsh.cpp
- cv/cvshapedescr.cpp
- cv/cvstardetector.cpp
- cv/cvsurf.cpp
- cv/cvundistort.cpp
- cvaux/cvba.cpp
- ../include/opencv/ml.h

The "ctype.h" that comes with the cross-compiler defines some macros that collide with your naming convention of local "_[A-Z]"-variables. The ctype.h shows the following defines:

#define _U 01
#define _L 02
#define _N 04
#define _S 010
#define _P 020
#define _C 040
#define _X 0100
#define _B 0200

This results in compiling errors when trying to compile OpenCV2.0 with the cross-compiler. The simplest solution to this problem, and therefore a possible patch is to rename all "_[A-Z]"-variables in the above mentioned files.

Regards,
Matthias


Related issues (Add)


History

Updated by Scott Callaway about 4 years ago

I believe that defines that start with a single underscore '_' are reserved for the c-runtime, etc ( like _errno in a single threaded lib ) and defines that start with a double underscore '+' are reserved for the compiler -- or vis-versa.

An example below is from MS VS2008 -- stdlib.h file
_CRTIMP extern int +argc; /* count of cmd line args */

There are other possible options like converting them to C++ const vars that are in a namespace.

Updated by anonymous - about 4 years ago

The problem should have been fixed in r2916; please, check and reopen the ticket if the problem remains.

  • Status changed from Open to Done
  • Pull request set to fixed

Also available in: Atom PDF