Using winelib to compile MFC application on Linux

Questions about Wine on Linux
Locked
Vlad1806
Newbie
Newbie
Posts: 2
Joined: Wed Nov 29, 2023 6:57 am

Using winelib to compile MFC application on Linux

Post by Vlad1806 »

I am trying to run a simple dialog base MFC application on Linux. I managed to compile MFC source to a static library (libmfc.a),
but when I run my shell script that supposed to build my Linux application I am getting the following error:

winegcc -o TryMFCApp.exe -L../../BIN_64 -lmfc -lstdc++ -lwinecrt0 -luuid -lcomdlg32 -lshell32 -lshlwapi -luser32 -lgdi32 -ladvapi32 -lcomctl32 -lcomdlg32 -lkernel32 -lole32 -loleaut32 -lwinspool -luxtheme -lmsvcrtd -lmsvcr90
/opt/wine-staging/bin/../lib64/wine/x86_64-unix/libwinecrt0.a(exe_main.o): In function `main':
(.text.startup+0xb1): undefined reference to `WinMain'

Here is my script:

#!/bin/bash
winemaker --lower-uppercase --mfc --guiexe \
-I/opt/wine-devel/include/wine/ \
-I/opt/wine-devel/include/wine/windows \
-I/opt/wine-devel/include/wine/msvcrt \
-I/usr/include/linux \
-I/include \
-I../MFCLinux/include \
-I../../include \
-I../../../../MFCLinux/include \
-I../Source/MFCLinux/include \
-I/crt \
-D_WIN64 \
-D_M_AMD64 \
-D_MSVCR_VER=90 \
-D_AFX_PORTABLE \
-D_FORCENAMELESSUNION \
-D_AFX_NO_OCX_SUPPORT \
-D_AFX_NO_DEBUG_CRT \
-D_ATL_NO_DEBUG_CRT \
-D_ATL_SECURE_NO_WARNINGS \
-D_DEBUG \
-L../../BIN_64 \
-lmfc \
-lstdc++ \
-luuid \
-lcomdlg32 -lshell32 -lshlwapi -luser32 -lgdi32 -ladvapi32 -lcomctl32 -lcomdlg32 -lkernel32 -lole32 -loleaut32 -lwinspool -luxtheme -lmsvcrt -lmsvcrtd -lmsvcr90 \
--single-target TryMFCApp.exe \
TryMFCApp.vcproj
make &> errors.txt.

I found one workaround on Internet, where MFC source is compiled with the application source to build a shared library,
in which case all MFC files have to be recompiled every time I update my application. No a good option.
Couldn't find any relevant example on Internet on how to build MFC app using winemaker or winebuild.
I am new in Linux. Please help.
Locked