为了在Linux上创建一个独立的控制台应用程序,工作环境是在Mac x10.7上进行的。
1.)打开Monodevelop并创建新的解决方案,即"C#控制台项目“。2.)构建应用程序时,exe将在bin/Release文件夹3中创建。)在mac os x打开终端中,goto文件夹并键入:mkbundle -o HelloTest HelloWorld.exe -deps。
这将发生:
OS is: Darwin
Sources: 1 Auto-dependencies: True
embedding: /Users/fredrickbacker/Documents/Mono/HelloWorld/HelloWorld/bin/Release/HelloWorld.exe
embedding: /Library/Frameworks/Mono.framework/Versions/2.10.9/lib/mono/4.0/mscorlib.dll
Compiling:
as -arch i386 -o temp.o temp.s
cc -arch i386 -g -o HelloTest -Wall temp.c `pkg-config --cflags --libs mono-2` temp.o
temp.c:2:39: error: mono/metadata/mono-config.h: No such file or directory
temp.c:3:36: error: mono/metadata/assembly.h: No such file or directory
temp.c:6: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘assembly_bundle_HelloWorld_exe’
temp.c:8: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘assembly_bundle_mscorlib_dll’
temp.c:10: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
temp.c:22: error: ‘NULL’ undeclared here (not in a function)
temp.c: In function ‘mono_mkbundle_init’:
temp.c:26: warning: implicit declaration of function ‘mono_register_bundled_assemblies’
temp.c:26: error: ‘bundled’ undeclared (first use in this function)
temp.c:26: error: (Each undeclared identifier is reported only once
temp.c:26: error: for each function it appears in.)
temp.c: In function ‘main’:
temp.c:118: warning: implicit declaration of function ‘mono_set_dirs’
[Fail]对我做错了什么有什么建议吗?想要一个独立的linux应用程序,从osx开发。拉我的头发好几个小时。
发布于 2012-10-13 12:58:50
您不能从OSX平台构建将在Linux平台上使用的二进制文件。请记住,mkbundle构建的是本机平台代码,而不是中间/JIT-可编译/MSIL代码。
这并不能解决OSX上的错误(我不知道出了什么问题),但是如果您想让应用程序在Linux上运行,请在Linux上安装Mono,然后从那里运行mkbundle。
https://stackoverflow.com/questions/12873326
复制相似问题