"duplicate symbol _bbToUpperData"

BlitzMax Forums/BlitzMax Programming/"duplicate symbol _bbToUpperData"

Pineapple(Posted 2015) [#1]
I've been doing work on a module that adds some new functions for working with strings and much of the code is written in C. My C file contains these lines:
#include <brl.mod/blitz.mod/blitz_string.h>
#include <brl.mod/blitz.mod/blitz_array.h>
#include <brl.mod/blitz.mod/blitz_unicode.h>

Apparently as a consequence of including blitz_unicode.h I'm now getting this error when I attempt to compile a file which imports the module in question. (But not when building modules.) The other includes don't cause any such issues. I'm running BlitzMax 1.50 on OSX.
duplicate symbol _bbToUpperData in:
    /Applications/BlitzMax150/mod/brl.mod/blitz.mod/blitz.release.macos.x86.a(blitz_string.c.release.macos.x86.o)
    /Applications/BlitzMax150/mod/mach.mod/strings.mod/strings.release.macos.x86.a(strings.c.release.macos.x86.o)
duplicate symbol _bbToLowerData in:
    /Applications/BlitzMax150/mod/brl.mod/blitz.mod/blitz.release.macos.x86.a(blitz_string.c.release.macos.x86.o)
    /Applications/BlitzMax150/mod/mach.mod/strings.mod/strings.release.macos.x86.a(strings.c.release.macos.x86.o)
ld: 2 duplicate symbols for architecture i386



Henri(Posted 2015) [#2]
Hi,

it seems <blitz_unicode.h> is already included in <blitz_string.h> hence the compiler error. You could use something like:
#ifndef BLITZ_UNICODE_H
#include <brl.mod/blitz.mod/blitz_unicode.h>
#endif


-Henri


Brucey(Posted 2015) [#3]
Unfortunately, blitz_unicode.h declares and implements the two arrays. This is fine until you want to use them yourself.

I ended up simply splitting it into header and source, along the lines of : https://github.com/bmx-ng/brl.mod/blob/master/blitz.mod/blitz_unicode.h


Pineapple(Posted 2015) [#4]
Damn. I don't want to change the BRL files, though. I ended up copying the source and placing it in another file, and included that one.


Brucey(Posted 2015) [#5]
Damn. I don't want to change the BRL files, though

They (the mods) are open source. Fork and tweak as needed. No big deal really.


Pineapple(Posted 2015) [#6]
This is for a set of modules I'm writing and I wouldn't want to force a change of BRL files upon the user.