How to correctly launch a non-cmd application using Wine ?

Questions about Wine on Linux
Locked
BrainabilGH
Newbie
Newbie
Posts: 1
Joined: Mon May 14, 2018 8:13 am

How to correctly launch a non-cmd application using Wine ?

Post by BrainabilGH »

I am trying to launch my AppNoCMD (using C++) in a cluster based on linux 64bits having only a cmd mode (no GUI). For that I installed Win-3.8 using the following commands (I cannot use sudo since I am in a cluster):

Code: Select all

[b]~$[/b] mkdir bin/wine-3.8
[b]~$[/b] cd bin/wine-3.8/
[b]wine-3.8 $[/b] ../configure --enable-win64 --with-png --without-freetype && make
Here is my AppNoCMD code:

Code: Select all

#include <stdio.h>
#include <iostream>
#include <fstream>
#include <windows.h>

int main(HINSTANCE hInstance,
	HINSTANCE hPrevInstance,
	LPTSTR    lpCmdLine,
	int       nCmdShow){
		
	std::ofstream ofs("test.txt");
	if (ofs.is_open()){
		ofs << "This is just a test";
		ofs.close();
	}
	return 0;
}
I am using Visual Studio 2013, and I changed subsystem to Windows (/SUBSYSTEM:WINDOWS) so that I can launch this app in my windows without opening any GUI or window or console, and indeed it creates the test.txt file.
But wen I tried launching AppNoCMD in the cluster using this command:

Code: Select all

[b]wine-3.8 $ wine64 ../AppNoCMD.exe[/b]
I had the following error:

Code: Select all

000d:err:menubuilder:convert_to_native_icon [color=#FF0000]error[/color] 0x80004005 [color=#80FFFF]creating[/color] bitmap encoder
000d:err:wincodecs:PngEncoder_CreateInstance [color=#FF0000]Failed [/color]writing PNG because [color=#FFFF00]unable to[/color] find libpng16.so.16
000d:fixme:ole:CoCreateInstanceEx no instance created for interface {00000103-a8f2-4877-ba0a-fd2b6645fb94} of class {27949969-876a-41d7-9447-568f6a35a4dc}, hres is 0x80004005
What is wrong?
User avatar
Bob Wya
Level 12
Level 12
Posts: 3068
Joined: Sat Oct 16, 2010 7:40 pm

Re: How to correctly launch a non-cmd application using Wine

Post by Bob Wya »

BrainabilGH wrote:I am trying to launch my AppNoCMD (using C++) in a cluster based on linux 64bits having only a cmd mode (no GUI). For that I installed Win-3.8 using the following commands (I cannot use sudo since I am in a cluster):

Code: Select all

~$ mkdir bin/wine-3.8
~$ cd bin/wine-3.8/
wine-3.8  ../configure --enable-win64 --with-png --without-freetype && make
Here is my AppNoCMD code:

Code: Select all

...
I am using Visual Studio 2013, and I changed subsystem to Windows (/SUBSYSTEM:WINDOWS) so that I can launch this app in my windows without opening any GUI or window or console, and indeed it creates the test.txt file.
But when I tried launching AppNoCMD in the cluster using this command:

Code: Select all

[b]wine-3.8 $ wine64 ../AppNoCMD.exe[/b]
I had the following error:

Code: Select all

000d:err:menubuilder:convert_to_native_icon [color=#FF0000]error[/color] 0x80004005 [color=#80FFFF]creating[/color] bitmap encoder
000d:err:wincodecs:PngEncoder_CreateInstance [color=#FF0000]Failed [/color]writing PNG because [color=#FFFF00]unable to[/color] find libpng16.so.16
000d:fixme:ole:CoCreateInstanceEx no instance created for interface {00000103-a8f2-4877-ba0a-fd2b6645fb94} of class {27949969-876a-41d7-9447-568f6a35a4dc}, hres is 0x80004005
What is wrong?
For a totally headless Wine setup I'd try:

Code: Select all

../configure --without-fontconfig --without-freetype --without-gstreamer --without-png --without-x --without-xfixes --without-xcomposite --without-xinerama --without-opengl --without-jpeg --without-mpg123 --without-sdl --without-osmesa --without-pulse --without-alsa --without-gphoto --disable-mshtml --disable-mscoree --enable-win64
Which might work, but only for console only, pure 64-bit Windows applications.

Also disable Winemenubuilder.
(This Wine helper utility may not be build anyway - due to the amount of disabled Wine features.)

I presume your compiling your application, in Visual Studio, as a pure 64-bit application?
Because that is all that your self-built 64-bit only Wine version will run...

Code: Select all

file AppNoCMD.exe
should spit out:

Code: Select all

AppNoCMD.exe: PE32+ executable ... x86-64, for MS Windows
Bob
Locked