2

I have a declaration like this:

extern "C++" CHARSET_INFO compiled_charsets[];

which compiled fine so far, but now with the update to XCode 5.1 I get an error for that:

.../my_sys.h:277:27: Definition of variable with array type needs an explicit size or an initializer

It's certainly just a newly enabled LLVM check, but I'm curious to know how you would cope with such an error in general, especially if that is in a 3rd party header file you can't change. But also if you could change it what would it look like? I mean, how can I initialize an external array? It's defined somewhere else. It makes no sense to initialize the external reference.

Mike Lischke
  • 48,925
  • 16
  • 119
  • 181
  • The code is 100% legal, the bug is either in clang or in your environment. Are you seeing this error when compiling from the command line, or just from the IDE? – n. m. could be an AI Mar 11 '14 at 11:11
  • This is from within XCode 5.1. – Mike Lischke Mar 11 '14 at 11:13
  • Have you tried to compile from the command line? – n. m. could be an AI Mar 11 '14 at 11:15
  • That would not make any sense ,because 1) I need to use XCode. 2) The command line very likely uses the same compiler (I'd just compiling with the same toolset that XCode uses). – Mike Lischke Mar 11 '14 at 11:18
  • "That would not make any sense" --- I'm trying to diagnose the problem by eliminating the unknowns. XCode is one of the unknowns: no one is sure what exactly is going on inside. If you have other methods of troubleshooting in your toolbox, go ahead and try them. – n. m. could be an AI Mar 11 '14 at 11:31

1 Answers1

0

Found the solution myself. Not sure why is LLVM having trouble with this but removing the "C++" part makes it compile that code again:

extern CHARSET_INFO compiled_charsets[];
Mike Lischke
  • 48,925
  • 16
  • 119
  • 181