在Windows下编译Linux c++源码出现问题

问题描述 投票:0回答:1

我有一个源代码,这个 Zata 源代码是为 Linux 编写的,我在使用 mingw 编译此源代码以生成 .dll 文件时遇到问题。

我做了很多测试,甚至在项目内部进行了更改,甚至说也许 mingw 版本是新的,而这个源是旧的。我安装了旧版本的mingw,但仍然出现错误

我的来源(436kb): https://filebin.net/4ksdep67xsg8c43o

谢谢你帮助我

我什至编辑了makefile

GPP = g++ -m32 -Ilib -DSAMPGDK_AMALGAMATION -fno-stack-protector
GCC = gcc -m32 -Ilib -DSAMPGDK_AMALGAMATION -fno-stack-protector
FAKEBOTS_OUTFILE = "./FakeBots.dll"

COMPILE_FLAGS = -c -O3 -fpack-struct=1 -w -DWIN32

FakeBots = -D FakeBots $(COMPILE_FLAGS)

all: FakeBots

clean:
    -del /f /q *~ *.o *.dll 2>nul || true

FakeBots: clean
    $(GPP) $(FakeBots) ./lib/sdk/*.cpp
    $(GPP) $(FakeBots) ./lib/raknet/*.cpp
    $(GCC) $(FakeBots) ./lib/subhook/subhook.c
    $(GCC) $(FakeBots) ./lib/sampgdk/sampgdk.c
    $(GPP) -shared -o $(FAKEBOTS_OUTFILE) *.o -lws2_32

错误...

PS C:\Users\erfani\Desktop\bots
rm -f ~.0 *.so
daddypierce\bots
daddypierce> mingw32-make
process_begin: CreateProcess (NULL, rm -f ~ *.o .so, ...) failed.
make (e=2): The system cannot find the file specified. mingw32-make: [makefile:14: clean] Error 2 (ignored)
g++ -m32 -Ilib -DSAMPGDK_AMALGAMATION -fno-stack-protector -D FakeBots -c -03 -fpack-struct=1 -fPIC -w -DLINUX ./lib/sdk /*.cpp In file included from ./lib/sdk/plugin.h:8,
from ./lib/sdk/amxplugin.cpp:13:
./lib/sdk/plugincommon.h:35:21: note: #pragma message: Warning: Not using a VC++ compiler.
#pragma message "Warning: Not using a VC++ compiler."
Ame
In file included from ./lib/sdk/plugin.h:9,
from ./lib/sdk/amxplugin.cpp:13:
./lib/sdk/amx/amx.h:61:17: error: typedef int64
_divtc3
int64 does not name a type; did you mean '__divtc3'? int64_t;
./lib/sdk/amx/amx.h:62:35: error: expected initializer before 'uint64_t'
typedef unsigned_int64 uint64_t;
./lib/sdk/amx/amx.h:365:3: error: 'uint64_t' does not name a type; did you mean 'uint32_t'? uint64_t * AMXAPI amx_Align64 (uint64_t *v);
سية
uint32_t
./lib/sdk/amx/amx.h:381:72: error: 'size_t' has not been declared
Anemoore
int AMXAPI amx_GetString(char *dest, const cell source, int use_wchar, size_t size); ./lib/sdk/amx/amx.h:401:83: error: 'size_t' has not been declared int AMXAPI amx_SetString(cell #dest, const char *source, int pack, int use_wchar, size_t size); ./lib/sdk/amxplugin.cpp:36:11: error: 'uint64_t' does not name a type; did you mean 'uint32_t'? typedef uint64_t * AMXAPI (amx_Align64_t) (uint64_t *v);
uint32_t
Armerone
./lib/sdk/amxplugin.cpp:37:3: error: 'uint64_t' does not name a type; did you mean 'uint32_t'? uint64_t * AMXAPI amx_Align64 (uint64_t *v)
uint32_t
./lib/sdk/amxplugin.cpp:142:86: error: 'size_t' has not been declared
typedef int AMXAPI (*amx_GetString_t) (char *dest, const cell source, int use_wchar, size_t size);
./lib/sdk/amxplugin.cpp:143:72: error: 'size_t has not been declared
int AMXAPI amx_GetString(char *dest, const cell source, int use_wchar, size_t size)
Arcorona
Ancorare
./lib/sdk/amxplugin.cpp:282:97: error: 'size_t' has not been declared typedef int AMXAPI (*amx_SetString_t) (cell *dest, const char *source, int pack, int use_wchar, size_t size);
Anmooners
./lib/sdk/amxplugin.cpp:283:83: error: 'size_t' has not been declared
int AMXAPI amx_SetString(cell #dest, const char *source, int pack, int use_wchar, size_t size)
Amoore
mingw32-make: *** [makefile:17: FakeBots] Error 1
PS C:\Users\erfani\Desktop\bots - daddypierce\bots - daddypierce>
c++ visual-c++ mingw mingw-w64
1个回答
0
投票

这个项目源自 YSF,该项目 readme.md 说

建筑

在Windows上使用Visual Studio构建项目,或者在Linux上make或make static。为了构建 0.3.DL 版本,定义 SAMP_03DL。

要使用

mingw
进行编译以创建 Windows 库,您将需要在 .h 文件中进行许多更改,我不确定这是否值得。

© www.soinside.com 2019 - 2024. All rights reserved.