Using winebuild explicitly

Ralf Juengling juenglin at
Fri Jan 2 18:16:45 CST 2004

Hi Dimi,

On Wed, 2003-12-31 at 16:47, Dimitrie O. Paun wrote:
> On December 31, 2003 07:42 pm, Ralf Juengling wrote:
> > okay, now it's as before:
> As I said, I think there's something wrong with your
> ld setup. You need to have /usr/local/lib (where
> the libwine library is) in your /etc/

I tried this today, (adding /local/lib to /etc/ 
but it didn't make a difference.
I then looked into winegcc.c and winewrap.c to find out 
what winwgcc is actually doing. It is creating a shared 
library (dll) and a little wrapper executable to load the
shared library.

This should not be necessary with the code in question and
I would rather like to build just one executable. So I wrote
a Makefile that does this (not using winegcc & co) by 
calling winebuild explicitly (see below).

It seems to work, but when I start the executable by


I see the application's windows appearing and immediately 
disappearing and get the following error messages:

err:win:WIN_FindWndPtr window 0x20030 belongs to other process
err:win:WIN_FindWndPtr window 0x20030 belongs to other process

I wonder whether this error has to do with the way I built
the executable. The Makefile is as follows:

------ Makefile ------------------------------------------

INCLUDE_PATH = /local/include/wine
LIBRARY_PATH = /local/lib

# This should be replaced by wildcard expression as soon as all
# sources actually participate in the built.
PHAEACO_CSRCS  = ../gensrc/Statist.c

PHAEACO_CXXSRCS = Experim.cpp   Login.cpp   Phaeaco.cpp  TextWnd.cpp \
	Intrface.cpp  Mentor.cpp  Solver.cpp  List.cpp  
        ... (some more)

PHAEACO_RCSRCS = phaeaco.rc

PHAEACO_DLLS = advapi32 comdlg32 gdi32 kernel32 odbc32 ole32 \
	oleaut32 shell32 user32 winspool winmm comctl32 

INCLUDES  = -I. -I../geninc -I../coginc -I$(INCLUDE_PATH)
CC        = gcc
CFLAGS    = -g -fpack-struct $(DEFINES) 
CXX       = g++
CXXFLAGS  = -g -fpack-struct $(DEFINES)
OBJS      = $(PHAEACO_CSRCS:.c=.o) $(PHAEACO_CXXSRCS:.cpp=.o)
RESS      = $(PHAEACO_RCSRCS:.rc=.res)
LIBS      = -lwine -lm 
WBLIBS    = $(patsubst %,-l%,$(PHAEACO_DLLS)) : $(OBJS)
	winebuild -o phaeaco.spec.c --exe $(@) -mgui $(OBJS) $(RES) $(LDFLAGS)
	gcc -o phaeaco.spec.o -c phaeaco.spec.c
	$(CXX) -shared -Wl,-Bsymbolic,-z,defs -o $@ phaeaco.spec.o $(OBJS)
	strip --strip-all $(@)

%.o : %.cpp
	$(CXX) -c $(CXXFLAGS) $(CPPFLAGS) -o $@ $<

%.res : %.rc
	wrc $(DEFINES) $(INCLUDES) -o $@ $<

	rm -f ./*.o ../gensrc/*.o ../cogsrc/*.o

Ralf Juengling <juenglin at>

More information about the wine-devel mailing list