【发布时间】:2019-04-17 05:04:21
【问题描述】:
我正在尝试使用 msvc2017 从 github 编译 essnac-ng 库,以在现有的 qt-Project 中使用。
我设法使用 msys2(使用 make、autoconf、automake、yacc、bison)和 powershell 编译它:
cmd.exe /k "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat" x86 `& powershell
cd D:\Projekte\esnacc-ng
bash ./boot.sh
bash ./configure LD=linker.exe
make
make install
问题 1:它只在编译静态库时出现以下警告:
warning: undefined symbols not allowed in x86_64-pc-msys shared libraries; building static only
在尝试了此线程所说的内容后: libtool: undefined symbols not allowed in i686-pc-mingw32 shared 我在制作过程中遇到错误:
cl : Befehlszeile error D8021 : Ungültiges numerisches Argument /Wl,-DLL,-IMPLIB:cxx-lib/.libs/cxxasn1.dll.lib.
make[1]: *** [Makefile:1641: cxx-lib/libcxxasn1.la] Error 2
make[1]: Leaving directory '/d/Projekte/esnacc-ng'
make: *** [Makefile:1370: all] Error 2
PS D:\Projekte\esnacc-ng>
问题 2: 尝试在我的 pri 文件中使用这样的静态库:
LIBS += -L$$PWD/cxx-lib/libs/ -lcxxasn1
LIBS += -L$$PWD/cxx-lib/libs/ -lcxxasn1rose
INCLUDEPATH += $$PWD
INCLUDEPATH += $$PWD/cxx-lib/inc
HEADERS += $$PWD/MyAsnFile.h
SOURCES += $$PWD/MyAsnFile.cpp
QMAKE_CFLAGS_MT+=$$PWD/cxx-lib/inc
QMAKE_CXXFLAGS_MT+=$$PWD/cxx-lib/inc
#QMAKE_CFLAGS_RELEASE += /MD
DISTFILES += \
$$PWD/cxx-lib/inc/snacc.h.in
我在编译期间收到错误:
Fehler: LNK2038: Konflikt ermittelt für "RuntimeLibrary": Der Wert "MT_StaticRelease" stimmt nicht mit dem Wert "MD_DynamicRelease" in main.obj überein.
我在这里看到了这个帖子,但不确定如何将其转换为对自己有用的东西: LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in file.obj
【问题讨论】:
-
This answer 表示需要做什么。那么还有什么不清楚的呢?
-
我不确定,我没有在两者中的任何一个中使用任何 /mt /md 参数。我什至如何找出现状以查看哪个是使用哪个设置编译的?如何在编译 esnacc 时添加 /mt 或 /md 参数?
-
我尝试添加 CFLAGS=-MD 或 CXXFLAGS,结果相同(MT 也一样)
标签: c++ visual-studio qt compiler-errors linker