Ben
Ben

Reputation: 1311

mkbundle produces non-functional console exe

I can successfully build a bundled exe from my MonoDevelop C# project, but when I run the bundle, it doesn't do anything; execution is terminated immediately and silently. What am I doing wrong?

I'm using Mono 2.10.5 on 64-bit Windows 7 with cygwin generally following these instructions, but with these modifications. The exact steps I follow are:

  1. Create new C# console project in MonoDevelop (contains only Console.WriteLine ("Hello World!");)
  2. Change target to Release
  3. Build all
  4. In cygwin: mkbundle -c -o host.c -oo bundle.o --deps BundleTest.exe
  5. Edit host.c, add #undef _WIN32 after #endif after #include <windows.h>
  6. In cygwin: gcc -mno-cygwin -o test.exe -Wall host.c 'pkg-config --cflags --libs mono-2|dos2unix' bundle.o
  7. In command prompt: test.exe
  8. In command prompt: BundleTest.exe

In step 7, the text "Hello World!" is printed in the command prompt as expected. In step 8, nothing is printed in the command prompt; the exact same response can be elicited by typing rem and pressing enter.

EDIT: Someone else edited this question to switch steps 7 and 8, which substantively changes the description of the observed behavior. I don't know why they felt justified in doing this since they were not the ones making the observations, but it is so far removed from the time I was thinking about this problem that I don't want to just switch the back the way they were. So, note that the last paragraph before this edit probably doesn't accurately reflect my original observations any more.

Upvotes: 4

Views: 625

Answers (1)

roguepnz
roguepnz

Reputation: 113

For building console application you should remove -mwindows flags from /lib/pkgconfig/mono-2.pc

Upvotes: 3

Related Questions