我写了一些控制台"Hello world"的应用程序.并且已经跟着c#cywgwin mono mkbundle windows 7 - 无法编译文件的答案.但我得到了:
$ mkbundle -o Fur Furries.exe --deps -z
OS is: Windows
Sources: 1 Auto-dependencies: True
embedding: C:\Monotest\Furries.exe
compression ratio: 40.43%
embedding: C:\Soft\Mono\lib\mono\4.0\mscorlib.dll
compression ratio: 34.68%
Compiling:
as -o temp.o temp.s
gcc -mno-cygwin -g -o Fur -Wall temp.c `pkg-config --cflags --libs mono-2|dos2un
ix` -lz temp.o
temp.c: In function `main':
temp.c:173: warning: implicit declaration of function `g_utf16_to_utf8'
temp.c:173: warning: assignment makes pointer from integer without a cast
temp.c:188: warning: assignment makes pointer from integer without a cast
/tmp/ccQwnxrF.o: In function `main':
/cygdrive/c/Monotest/temp.c:173: undefined reference to `_g_utf16_to_utf8'
/cygdrive/c/Monotest/temp.c:188: undefined reference to `_g_utf16_to_utf8'
collect2: ld returned 1 exit status
[Fail]
Run Code Online (Sandbox Code Playgroud)
它在Windows XP中.
Lav*_*let 13
首先,准备开发环境:
C:\Soft\Mono"中.bash --login -i"命令).$HOME/.bashrc用"nano"(" nano ~/.bashrc")打开" " .不要使用不保留行尾-s("CR","LF","CR/LF"或其他)的编辑器,否则会损坏文件!将以下行添加到文件末尾:
export PKG_CONFIG_PATH=/cygdrive/c/Soft/Mono/lib/pkgconfig
export PATH=$PATH:/cygdrive/c/Soft/Mono/bin
Run Code Online (Sandbox Code Playgroud)重启Cygwin Bash shell.
之后,您可以使用"mkbundle"编译程序集:
mkbundle -c -o host.c -oo bundle.o --deps YourAssembly.exe <additional arguments>".您也可以选择传递" -z"以压缩结果包.你应该得到"host.c"和"bundle.o"文件.在"host.c"中,您应该删除"_WIN32""branch"(" #include <windows.h>"之一除外).它不起作用.您可以通过#undef _WIN32在其后面的行后面添加" "来实现:
#ifdef _WIN32
#include <windows.h>
#endif
Run Code Online (Sandbox Code Playgroud)
所以你会得到:
#ifdef _WIN32
#include <windows.h>
#endif
#undef _WIN32
Run Code Online (Sandbox Code Playgroud)执行以下命令:" gcc -mno-cygwin -o ResultantBundle.exe -Wall host.c `pkg-config --cflags --libs mono-2|dos2unix` bundle.o <additional arguments>".如果在步骤2中添加了-z附加参数,则必须在此步骤中添加-lz附加参数.