gpt4 book ai didi

c++ - Winelib - 控制台应用程序

转载 作者:太空宇宙 更新时间:2023-11-04 12:19:55 31 4
gpt4 key购买 nike

我正在开发一个在 Linux 上运行并使用 Wine 调用 Windows dll 的控制台应用程序。

虽然我能够调用 dll,但在运行 .exe 控制台应用程序时我得到了一些意外的输出。

例如:

err:ole:marshal_object couldn't get IPSFactory buffer for interface {00000131-0000-0000-c000-000000000046}
err:ole:marshal_object couldn't get IPSFactory buffer for interface {6d5140c1-7436-11ce-8034-00aa006009fa}
err:ole:StdMarshalImpl_MarshalInterface Failed to create ifstub, hres=0x80004002
err:ole:CoMarshalInterface Failed to marshal the interface {6d5140c1-7436-11ce-8034-00aa006009fa}, 80004002
err:ole:get_local_server_stream Failed: 80004002
err:winediag:nulldrv_CreateWindow Application tried to create a window, but no driver could be loaded.
err:winediag:nulldrv_CreateWindow The graphics driver is missing. Check your build!
err:winediag:nulldrv_CreateWindow Application tried to create a window, but no driver could be loaded.
err:winediag:nulldrv_CreateWindow The graphics driver is missing. Check your build!
err:ole:apartment_createwindowifneeded CreateWindow failed with error 0
err:ole:apartment_createwindowifneeded CreateWindow failed with error 0
err:ole:marshal_object couldn't get IPSFactory buffer for interface {00000131-0000-0000-c000-000000000046}
err:ole:apartment_createwindowifneeded CreateWindow failed with error 14007
err:ole:StdMarshalImpl_MarshalInterface Failed to create ifstub, hres=0x800736b7
err:ole:CoMarshalInterface Failed to marshal the interface {6d5140c1-7436-11ce-8034-00aa006009fa}, 800736b7
err:ole:get_local_server_stream Failed: 800736b7
err:winediag:nulldrv_CreateWindow Application tried to create a window, but no driver could be loaded.
err:winediag:nulldrv_CreateWindow The graphics driver is missing. Check your build!
err:winediag:nulldrv_CreateWindow Application tried to create a window, but no driver could be loaded.
err:winediag:nulldrv_CreateWindow The graphics driver is missing. Check your build!
err:winediag:nulldrv_CreateWindow Application tried to create a window, but no driver could be loaded.
err:winediag:nulldrv_CreateWindow The graphics driver is missing. Check your build!
Could not load wine-gecko. HTML rendering will be disabled.

Wine 似乎希望 .exe 成为一个 Gui 应用程序。

我使用 Cmake 编译。这是我的 Cmake 说明:

# --- Script Setup

cmake_minimum_required (VERSION 2.8)

#if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
# message(FATAL_ERROR "In-source builds are not allowed.")
#endif("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")

# Disable in-source builds and modifications
# to the source tree.
#set(CMAKE_DISABLE_SOURCE_CHANGES ON)
#set(CMAKE_DISABLE_IN_SOURCE_BUILD ON)

# Enable compiler tests.
enable_testing()

set(CMAKE_CXX_COMPILER wineg++)
set(CMAKE_CCC_COMPILER winegcc)

project(CREDIT_SERVICE C CXX)

if(NOT CMAKE_BUILD_TYPE)
# Build debug by default.
set(CMAKE_BUILD_TYPE Debug CACHE STRING "Choose build type (options are None, Debug, Release, RelWithDebInfo and MinSizeRel)." FORCE)
endif(NOT CMAKE_BUILD_TYPE)

# --- Compiler Properties

set(CREDIT_SERVICE_MAJOR_VERSION 1)
set(CREDIT_SERVICE_MINOR_VERSION 0)
set(CREDIT_SERVICE_PATCH_VERSION 0)
set(CREDIT_SERVICE_BUILD_VERSION 0)
set(CREDIT_SERVICE_VERSION ${COIN_MAJOR_VERSION}.${CREDIT_SERVICE_MINOR_VERSION}.${CREDIT_SERVICE_PATCH_VERSION}.${CREDIT_SERVICE_PATCH_VERSION})

message(STATUS "Building COIN version ${COIN_VERSION} using build type '${CMAKE_BUILD_TYPE}'.")
message(STATUS " Source directory is '${PROJECT_SOURCE_DIR}'.")
message(STATUS " Build directory is '${PROJECT_BINARY_DIR}'.")

# --- Compiler Flags

add_definitions( -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS )

# Enable most warnings.
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic -Wall -Wextra -Wshadow -Wundef -Wpointer-arith -Wcast-align -Wwrite-strings")

#add version 0x600 as windows define.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_WIN32_WINNT=0x600")

# Use C++11.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")

# Enable/disable optimisation depending on build type.
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Os")

# Add version as preprocessor defines.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DCOIN_VERSION=${COIN_VERSION}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DCOIN_MAJOR_VERSION=${COIN_MAJOR_VERSION}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DCOIN_MINOR_VERSION=${COIN_MINOR_VERSION}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DCOIN_PATCH_VERSION=${COIN_PATCH_VERSION}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DCOIN_BUILD_VERSION=${COIN_BUILD_VERSION}")


# Enable/disable profiling information.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pg")

# --- Subdirectories

# All headers are in the /include directory.
include_directories (
"${PROJECT_SOURCE_DIR}/include"
)
link_directories ("/usr/local/lib"
)
# Examples.
add_subdirectory(UnitTest)

# Library code.

add_subdirectory(config4cpp)

add_subdirectory(configure)

add_subdirectory(src)

我尝试添加:

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /SUBSYSTEM:console")

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --subsystem console")

但是 cmake 没有识别这些。

我如何告诉 Wine 它是一个控制台应用程序并且不需要 GUI?

最佳答案

好吧,如果您确定问题出在子系统上,那么您可以更改它

editbin.exe /subsystem:console app.exe

editbin 工具是 MSVC 自带的。您也可以在十六进制编辑器中编辑该文件,但首先需要找出其中子系统字段的偏移量。

关于c++ - Winelib - 控制台应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46316222/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com