Can someone explain why this code gives an compiler error? It works if I keep all the code in one file.
Main Modul:
Code: Select all
Declare Sub TestSub
Extern As Integer Test(), TestUbound
Dim As Integer Test(), TestUbound
ReDim Test(40)
Print "Ubound Test: " & UBound(Test)
TestSub
Print "Ubound Test: " & UBound(Test)
Sleep
Code: Select all
Extern As Integer Test(), TestUbound
Sub TestSub
TestUbound = 50
ReDim Preserve Test(TestUbound)
End Sub
Code: Select all
D:\Dev\FreeBASIC\fbc -c "test.bas"
Make done
D:\Dev\FreeBASIC\fbc -s console "Dim test.bas" "test.o"
test.o:fake:(.data+0x0): multiple definition of `TEST'
Dim test.o:fake:(.data+0x0): first defined here
Make done