Page 1 of 1
Can't build from source
Posted: November 28th, 2011, 11:03 pm
by boblol0909
I seem to not be able to build from the latest source r1259. When I try to compile I get an error: Error Cannot take the address of, get the size of, or declare a pointer to a managed type ('System.RuntimeTypeHandle').
at line 590, column 34 in ExtensionMethods.cs
Code: Select all
public static int SizeOf( Type type ) {
if( type.IsValueType ) {
return System.Runtime.InteropServices.Marshal.SizeOf( type );
} else {
RuntimeTypeHandle th = type.TypeHandle;
return *(*(int**)&th + 1); // <--- this line
}
}
What am I doing wrong lol(I downloaded a fresh copy, I have not modified it)
Re: Can't build from source
Posted: November 29th, 2011, 6:54 pm
by Jonty800
This is in my source:
Code: Select all
/*public static int SizeOf( object obj ) {
return SizeOf( obj.GetType() );
}
public static int SizeOf( Type type ) {
if( type.IsValueType ) {
return System.Runtime.InteropServices.Marshal.SizeOf( type );
} else {
RuntimeTypeHandle th = type.TypeHandle;
return *(*(int**)&th + 1);
}
}*/
I guess it was either already like this or GlennMR commented it out.
Just comment it?
Are you using .NET v4.0?
Re: Can't build from source
Posted: November 29th, 2011, 7:02 pm
by fragmer
You are trying to build fCraft for .NET 4.0. fCraft was developed for .NET 3.5.
It's mostly compatible, except for a few things like that SizeOf. I only really use it for debugging/profiling, so you can safely comment it out.
Note that you may have problems merging future changes from fCraft's SVN to your code if you update to .NET 4.0, because VisualStudio 2010 uses a different solution/project file format.
Re: Can't build from source
Posted: November 29th, 2011, 11:08 pm
by boblol0909
fragmer wrote:You are trying to build fCraft for .NET 4.0. fCraft was developed for .NET 3.5.
It's mostly compatible, except for a few things like that SizeOf. I only really use it for debugging/profiling, so you can safely comment it out.
Note that you may have problems merging future changes from fCraft's SVN to your code if you update to .NET 4.0, because VisualStudio 2010 uses a different solution/project file format.
I just commented it out and it works, thanks. And so far 2010's been able to convert the proj files successfully.