Compile error "Undefined symbols for architecture"

BlitzMax Forums/BlitzMax Programming/Compile error "Undefined symbols for architecture"

Pineapple(Posted 2015) [#1]
I've been working on this code for a little while and now, without apparent cause, I get this error when I attempt to compile. I'm using 1.50 on OSX Mavericks. Help?

Compiling:Collection.bmx
Compiling:CollectionIndexed.bmx
Linking:CollectionIndexed
Undefined symbols for architecture i386:
  "__7", referenced from:
      __bb_CollectionIndexed_set in CollectionIndexed.bmx.console.release.macos.x86.o
      __bb_CollectionIndexed_get in CollectionIndexed.bmx.console.release.macos.x86.o
      __bb_CollectionIndexed_push in CollectionIndexed.bmx.console.release.macos.x86.o
      __bb_CollectionIndexed_pop in CollectionIndexed.bmx.console.release.macos.x86.o
      __bb_CollectionIndexed_insert in CollectionIndexed.bmx.console.release.macos.x86.o
      __bb_CollectionIndexed_remove in CollectionIndexed.bmx.console.release.macos.x86.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Build Error: Failed to link /_/_/_/_/collect/CollectionIndexed[Finished in 0.5s with exit code 255]
[cmd: ['/Applications/BlitzMax150/bin/bmk', 'makeapp', '-r', '-a', '-t', 'console', '-x', 'CollectionIndexed.bmx']]
[dir: /_/_/_/_/collect]


CollectionIndexed.bmx, which fails to compile:


And Collection.bmx, the singular import, which compiles without incident:




Brucey(Posted 2015) [#2]
Oh dear, you're building it on a Mac, aren't you? :-/


Pineapple(Posted 2015) [#3]
I am indeed. This is the first time I've run into any such confounding issues, though.


Brucey(Posted 2015) [#4]
Well done. You've discovered a bug in the compiler (bcc) !!

The issue is because of this line :
const EXCEPTION_UNIMPLEMENTED:object = "operation is not applicable to this class"

You should probably define it as a String.


On Linux, the error (in FASM) is :
/path/.bmx/CollectionIndexed.bmx.console.release.linux.x86.s [199]:
_3:
error: symbol already defined.
Build Error: Failed to assemble /path/.bmx/CollectionIndexed.bmx.console.release.linux.x86.s
Process complete


... in other news, my compiler also breaks. Thanks for giving me something to do ;-)


Pineapple(Posted 2015) [#5]
Ah! Thanks for spotting that. How come it broke CollectionIndexed but not Collection?


Brucey(Posted 2015) [#6]
The issue appears in the interface (.i) file for Collection that is generated by bcc :

...
Collection^Object{
EXCEPTION_UNIMPLEMENTED:Object="_3"
...


The interface file is loaded by bcc when compiling CollectionIndexed.bmx, providing it will all the Type and function definitions it needs to know about.

The "_3" is a reference to a string pointer in the generated Collection source. This of course, is not accessible outside of the compiled Collection .o file...
Hence you get interesting "number" errors when the generator tries to access imported references that don't exist.

Ooer!