My first winelib app - where am I going wrong?

Open forum for end-user questions about Wine. Before asking questions, check out the Wiki as a first step.
Forum Rules
Locked
nonoitall
Newbie
Newbie
Posts: 2
Joined: Tue Dec 16, 2008 5:26 pm

My first winelib app - where am I going wrong?

Post by nonoitall »

I eventually want to write a Linux application that can load Windows DLLs using winelib (I can do that, right?) but to start off, I just wanted to do a little Hello World test. Here's what I've got:

main.c

Code: Select all

#include <windows.h>

int main(int argc, char** argv) {
	
	MessageBox(NULL, "Hello world.", "Hello", MB_OK);
	
	return 0;
	
}
This compiles fine using Mingw32 and I can successfully run the resulting binary in Wine:

Code: Select all

i586-mingw32msvc-gcc *.c -o main.exe
wine main.exe
Now I try to compile the same code with Winelib, but I'm having problems:

Code: Select all

winegcc -mwindows -mno-cygwin *.c -o main
/usr/bin/ld: skipping incompatible /usr/lib/libm.so when searching for -lm
/usr/bin/ld: skipping incompatible /usr/lib/libm.a when searching for -lm
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.3.2/../../../libm.so when searching for -lm
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.3.2/../../../libm.a when searching for -lm
/usr/bin/ld: skipping incompatible /usr/lib/libm.so when searching for -lm
/usr/bin/ld: skipping incompatible /usr/lib/libm.a when searching for -lm
/usr/bin/ld: cannot find -lm
collect2: ld returned 1 exit status
winegcc: gcc failed
I also tried using winemaker on the source file and using make with the generated makefile, but ran into the same problem. I'm using Ubuntu 8.10 x64 if that's significant. Any tips on how to get Hello World working? Thanks in advance.
vitamin
Moderator
Moderator
Posts: 6605
Joined: Sat Feb 23, 2008 2:29 pm

Re: My first winelib app - where am I going wrong?

Post by vitamin »

nonoitall wrote:Now I try to compile the same code with Winelib, but I'm having problems:

Code: Select all

winegcc -mwindows -mno-cygwin *.c -o main
This is not correct. You need to use something like this:

Code: Select all

winegcc -Bwinebuild -I/usr/include/local/src/wine.git-build/include -I/usr/local/src/wine.git/include -mwindows test.c -o test.exe.so -luser32 -lkernel32
Adjust path to your Wine's include directory.
nonoitall
Newbie
Newbie
Posts: 2
Joined: Tue Dec 16, 2008 5:26 pm

Post by nonoitall »

Heh, that didn't work either, but it gave me a different error saying it couldn't find stubs-32.h. Googled, found out I needed libc6-dev-i386. Installed it and now it compiles either way. :) Thanks for pointing me in the right direction!
Locked