Jump to content

Compiling Mumech


Recommended Posts

so i got revision 60 loaded into visual studio 2010. and was trying to get it to compile. i want to add freetrack support for hull cameras. but before i can do that i need to get the thing to compile. it does actually compile but i get this when i try to launch ksp:


..
Being asked to load D:/KSPdev/KSP_Data/../Plugins\MuMechLib.dll

(Filename: C:/BuildAgent/work/300357e52574df36/Runtime/ExportGenerated/StandalonePlayer/UnityEngineDebug.cpp Line: 43)

Non platform assembly: D:\KSPdev\Plugins\MuMechLib.dll (this message is harmless)
Loading assembly: MuMechLib, Version=1.9.1.0, Culture=neutral, PublicKeyToken=null

(Filename: C:/BuildAgent/work/300357e52574df36/Runtime/ExportGenerated/StandalonePlayer/UnityEngineDebug.cpp Line: 43)

Exception when loading MuMechLib, Version=1.9.1.0, Culture=neutral, PublicKeyToken=null: System.Reflection.ReflectionTypeLoadException: The classes in the module cannot be loaded.

at (wrapper managed-to-native) System.Reflection.Assembly:GetTypes (bool)

at System.Reflection.Assembly.GetTypes () [0x00000] in <filename unknown>:0

at ModuleLoader.LoadAssembly (System.Reflection.Assembly asm) [0x00000] in <filename unknown>:0
...

did some search-fu, found the z trick, however that didnt work either. i haven't actually made any changes to the code yet. any help would be appreciated.

i should also point out that my c# is not strong (i prefer c/++ and lua), though i did read the entire syntax article on wikipedia.

Link to comment
Share on other sites

i guess i can keep rolling back revisions till it works.

im not 100% sure i can load the freetrackclient.dll from the plugin, especially considering it was written in delphi. i was able to access the dll from lua standalone so i may end up being better off implementing it through autom8, assuming autom8 both lets you load modules and change camera angles. so i have a couple angles of attack with which to approach the problem.

Link to comment
Share on other sites

seems i cant go back very far as far as revisions go before im at a version no longer compatible with version 0.16. and none of those seemed to work. probibly some kind of configuration issue with the build environment.

Link to comment
Share on other sites

k, so it turns out talking to freetrack is easy, getting mumech to work, thats hard.

i decided to take a different approach. i followed the basic hello world in the wiki (normally i skip these and dive into the advanced stuff, after all code is code), and it worked for the most part. then i tried the freetrack interface code that i had intended to use for mumechlib. it just printed the data to the log when the part was inited. so its at this point i either re-invent the wheel and spin my own camera plugin. id rather not do that since mumech already has a pretty good camera feature. i had intended to get it working and post a diff against their svn repo for them to implement at their leisure. im not sure what to do at this point. though i have a hunch that sharp lua has something to do with it, that perhaps there is extra configuration neccisary for it not throw an exception.

problem solved :D

Edited by Nuke
Link to comment
Share on other sites

Well now I can't get MuMech working. I'm using MonoDevelop it compiles fine with both .NET and MONO 4.0, but all MuMech parts are grayed out in the VAB. When I try to compile in 3.5 I get a bunch of "default parameter specifiers not allowed" errors as in, public void MyFunction(bool MyBool = false;){}. Is it correct that default parameters are not valid until .NET 4.0?

Link to comment
Share on other sites

That explains the problem. Maybe there's a hidden option involved, but Monodevelop seems to link the framework to the compiler, when I target the 3.5 framework MonoDevelop switches to a 3.5 compiler and stops allowing optional arguments.

Link to comment
Share on other sites

That explains the problem. Maybe there's a hidden option involved, but Monodevelop seems to link the framework to the compiler, when I target the 3.5 framework MonoDevelop switches to a 3.5 compiler and stops allowing optional arguments.

IIRC, the only difference between a 3.5 build and a 4.0 build is which assemblies your assembly references. Try building from the command line. The /nostdlib and /noconfig flags should be of some use.

There's also the old workaround of using a series of method overloads:

int Func(bool NonOptArg, int OptArg) {

// do stuff

}

int Func(bool NonOptArg) {

return Func(NonOptArg, 5);

}

Edited by Echo 8 ÉRÀ
Link to comment
Share on other sites

I didn't really want to throw in a bunch of overloads just to get it to compile.

Long story short, you can't configure it monodevelop, you have to build it from the command line.

Well, I got it figured out. You can't target the .NET3.5 framework in monodevelop and use the csc.exe included in .NET v4. I tried removing the 4.0 system and system.core references and pointing to the 3.5 dlls, but it automatically adds a reference to the 4.0 System.Core, and fails to compile.

Handily the error message has the complete command line that it tried to execute, so I copied that into a batch file and removed the extra .dll, strangely this ran into the character limit for a single command, so I had to change from full paths to local ones.

Link to comment
Share on other sites

  • 3 weeks later...

How in the world do you actually set up the solution in VS? I've never used c#, I've always been a c++ person. Do I just load the files straight into Visual studio and hit build or is there something outside of the svn I need? Are there any properties I need to set up inside the solution itself?

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...