I'm doing some experiments creating and building custom libraries, using #develop and trying to learn C#.
After building a source library in VB.net found on Internet and targeting .NET 2.0 (not CF, it should be a Desktop only DLL), adding such DLL to a B4PPC project I got the attached error.
What's the meaning? Any suggestion on how to fix/avoid such message?
It usually means that you have a class in a library with a name that already exists in another library or in Basic4ppc. Namespaces are not respected in Basic4ppc libraries so name clashes must be avoided. Also Private is not respected so you will see unwanted objects appearing in the Add Object menu list. You can hide unwanted classes/structs/enums by prefacing their name with an underscore. However with VB you will probably unavoidably see extra stuff added by the VB compiler. C# doesn't (usually!) do this.
Private for fields is however respected and can be used to hide them Personally I make all fields Private and implement Properties to access them.
Also avoid nested classes in a Basic4ppc library, it doesn't handle them gracefully.
__________________
Sorry, but I don't answer questions by PM or email.
Please post your queries in the forum.
The app I'm working on used to compile fine, but I made a few changes and now it doesn't compile in any flavour. Here's the error message:
Error compiling program.
\\Profile\AppData(Roaming)\Anywhere Software\Basic4ppc\Tzor\Class1.cs(297,10): error CS1012: Too many characters in character literal
I've rem'd out swathes of code trying to identify the problem, but have drawn a blank. If I had a bit more to go on I may have a chance.
It look like something in your Basic4ppc code is confusing the optimising compiler and it is producing bad C# code. Keep hacking bits away till the error goes, if you get it small and it still won't compile then post the source.
__________________
Sorry, but I don't answer questions by PM or email.
Please post your queries in the forum.
Hello erel,
I tried to compile a windows.exe in optimized compilation Mode and get an error. I know the error from a missing Object declaration. But now it is the line where a Sub begins. What is to do?
PS:I only paste the sub because the whole project is to large.
Best regards and a happy new year
bernd goedecke
Sub GetLen <--- Here the compiler produced the error: Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt.
a = 0
tzerr = ""
f=False
Main.DatAnz=0
Dim Main.SpW(Main.SpAnz)
Dim Main.SpWM(Main.SpAnz)
Dim Main.SpTyp(Main.SpAnz)
Dim Main.SpForm(Main.SpAnz)
Dim Main.NumCol(Main.SpAnz)
Dim Main.DatCol(Main.SpAnz)
Dim Main.DezCol(Main.SpAnz)
FStr=""
For i = 0 To Main.SpAnz-1
Main.NumCol(i) = True
Main.DatCol(i) = True
Main.DezCol(i) = True
Next
Do While dum <> EndStr AND dum <> EOF
If Main.DatAnz Mod 100 = 0 Then
TBConDeb.Text = "Ermittle VarChar-Länge: " & Aktdat & " Datensatz:" & Main.DatAnz
DoEvents
End If
If TxtTyp = "SAP Dynamische-Liste" Then
dum = SubString (dum,1, dLen-3)
End If
Main.TempArr() = StrSplit(dum, Delim)
If ArrayLen(Main.TempArr()) <> Main.SpAnz Then
EdKStr = TZErrIn.Show("beheben..","Trennzeichenfehler",dum, 0,0)
Main.TempArr() = StrSplit(EdKStr, Delim)
End If
For i = 0 To Main.SpAnz-1
If TxtTyp = "SAP Dynamische-Liste" Then
Main.TempArr(i) = StrEx.Trim(Main.TempArr(i))
End If
If ArrayLen(Main.TempArr()) = Main.SpAnz Then
Main.SpW(i) = StrLength(Main.TempArr(i))
If Main.SpW(i) > Main.SpWM(i) Then
Main.SpWM(i) = Main.SpW(i)
End If
If a > Main.SpAnz-1 Then
If Main.TempArr(i)<>"" Then
Match2.Value = Regex2.Match(Main.TempArr(i))
Match22.Value = Regex22.Match(Main.TempArr(i))
If Match2.Success=False OR Match22.Success=True Then
Main.DezCol(i) = False
End If
Match5.Value = Regex5.Match(Main.TempArr(i))
If IsNumber(Main.TempArr(i)) = False OR Match5.Success=True Then
Main.NumCol(i) = False
End If
Match1.Value = Regex1.Match(Main.TempArr(i))
If Match1.Success=False Then
Main.DatCol(i) = False
End If
End If
End If
Else
For j = 0 To ArrayLen(Main.TempArr())-1
FStr = FStr & CRLF & Main.TempArr(j)
Next
F=True
End If
Next
If F=True Then
tzerr = tzerr & Main.DatAnz+1 & ", "
Msgbox("Trennzeichenfehler in Zeile: " & Main.DatAnz+1 & " " & dum)
F=False
End If
dum = FileRead(c1)
a = a+1
Main.DatAnz = Main.DatAnz+1
Loop
TBConDeb.Text = " Datensätze:" & Main.DatAnz
For i = 0 To Main.SpAnz-1
If i < Main.SpAnz-1 Then
If Main.SpWM(i) < 256 Then
If Main.SpWM(i) < 1 Then
Main.SpTyp(i) = "VARCHAR"
Main.SpWM(i)=1
Main.SpForm(i) = Main.SpWM(i)
Else
Main.SpTyp(i) = "VARCHAR"
Main.SpForm(i) = Main.SpWM(i)
End If
Else
Main.SpTyp(i) = "TEXT"
Main.SpForm(i) = ""
End If
Else
If Main.SpWM(i) < 256 Then
Main.SpTyp(i) = "VARCHAR"
Main.SpForm(i) = Main.SpWM(i)
Else
Main.SpTyp(i) = "TEXT"
'SpForm(i) = ""
End If
End If
If Main.NumCol(i) = True Then
Main.SpTyp(i) = "INTEGER"
End If
If Main.DatCol(i) = True Then
Main.SpTyp(i) = "DATE"
End If
If Main.DezCol(i) = True AND Main.NumCol(i) = False Then
Main.SpTyp(i) = "REAL"
End If
Next
End Sub