简体   繁体   English

mingw32无法链接到库

[英]mingw32 can't link to library

Alright, so this is an interesting one that has been tested on two versions of mingw*, it's probably user error but google failed me. 好吧,所以这是一个有趣的示例,已经在mingw *的两个版本上进行了测试,这可能是用户错误,但google无法使我成功。

I still can't build more complex projects correctly even though they ought to, for example - let's take the example included in the newton physics engine sdk, it's a pretty simple program. 我仍然无法正确构建更复杂的项目,即使它们应该这样做,例如-让我们以牛顿物理引擎sdk中包含的示例为例,它是一个非常简单的程序。

first we build newton using the included makefile (as specifically recommended by a maintainer because cmake kept outputting broken makefiles), this is simple enough - it outputs a perfectly reasonable .a file. 首先,我们使用包含的makefile生成牛顿(维护者特别推荐,因为cmake会不断输出损坏的makefile),这很简单-它输出一个非常合理的.a文件。

these are the flags in the newton makefile 这些是牛顿makefile中的标志

-c -Wall -Wno-strict-aliasing  -DPTW32_BUILD -DPTW32_STATIC_LIB -D_NEWTON_STATIC_LIB -D_MINGW_32_VER -m32 -O2 -fpic -g -msse -msse3 -msse4 -mfpmath=sse -ffloat-store -ffast-math -freciprocal-math -funsafe-math-optimizations -fsingle-precision-constant -I$(DG_INCLUDED_PATH) -I$(DG_INCLUDED_PHYSICS_PATH) -I$(DG_INCLUDED_MESH_PATH) -I$(DG_INCLUDED_OPENCL_PATH)

however, if I then want to actually build the example then we get some slight problems. 但是,如果我当时想实际构建示例,那么我们会遇到一些小问题。

g++ -march=core2 -o out.exe ex.cpp -g -m32 -lNewton 2>&1 | tee build.log

And what do we get? 那我们得到什么呢? linker errors. 链接器错误。 undefined references everywhere because the name mangling doesn't seem to match 到处都有未定义的引用,因为名称修改似乎不匹配

I'm probably just overlooking something obvious but I'm a tad lost as to what that obvious thing would be. 我可能只是忽略了一些显而易见的事情,但是对于那个显而易见的事情我有点迷茫。

*g++.exe (TDM-2 mingw32) 4.4.1 and g++.exe (GCC) 5.3.0 so that would be TDM mingw g++ 4.4.1 and vanilla mingw 5.3.0 * g ++。exe(TDM-2 mingw32)4.4.1和g ++。exe(GCC)5.3.0,因此将是TDM mingw g ++ 4.4.1和vanilla mingw 5.3.0

here's the makefile (you may notice some minor tweaks to the makefile from the default mingw32 makefile, that is because originally it didn't build at all until I fixed some whitespace problems): 这是makefile(您可能会注意到默认的mingw32 makefile对makefile进行了一些细微调整,这是因为最初它直到我解决一些空白问题时才完全生成):

#*******************************************************
#
# Newton game dynamics 
# copy right by Julio Jerez 2002 - 2012
#
#*******************************************************
#
# Generic makefile 
# this make file generate the libraries: 
# dg, physics, and newton
#
#*******************************************************  


# ******************************************************
#
# dg low level library
#
# ******************************************************
DG_INCLUDED_PATH = ../../source/core
DG_PATH = $(DG_INCLUDED_PATH)/
DG_SRCS = \
    $(DG_PATH)dgAABBPolygonSoup.cpp \
    $(DG_PATH)dgAsyncThread.cpp \
    $(DG_PATH)dgConvexHull3d.cpp \
    $(DG_PATH)dgConvexHull4d.cpp \
    $(DG_PATH)dg.cpp \
    $(DG_PATH)dgCRC.cpp \
    $(DG_PATH)dgDebug.cpp \
    $(DG_PATH)dgDelaunayTetrahedralization.cpp \
    $(DG_PATH)dgGeneralMatrix.cpp \
    $(DG_PATH)dgGeneralVector.cpp \
    $(DG_PATH)dgGoogol.cpp \
    $(DG_PATH)dgIntersections.cpp \
    $(DG_PATH)dgMatrix.cpp \
    $(DG_PATH)dgMemory.cpp \
    $(DG_PATH)dgMutexThread.cpp \
    $(DG_PATH)dgNode.cpp \
    $(DG_PATH)dgPolygonSoupBuilder.cpp \
    $(DG_PATH)dgPolyhedra.cpp \
    $(DG_PATH)dgPolyhedraMassProperties.cpp \
    $(DG_PATH)dgQuaternion.cpp \
    $(DG_PATH)dgRandom.cpp \
    $(DG_PATH)dgRefCounter.cpp \
    $(DG_PATH)dgRef.cpp \
    $(DG_PATH)dgSmallDeterminant.cpp \
    $(DG_PATH)dgSPDMatrix.cpp \
    $(DG_PATH)dgObb.cpp \
    $(DG_PATH)dgThread.cpp \
    $(DG_PATH)dgThreadHive.cpp \
    $(DG_PATH)dgTree.cpp \
    $(DG_PATH)dgTypes.cpp


# ******************************************************
#
# Physics engine files
#
# ******************************************************
DG_INCLUDED_PHYSICS_PATH = ../../source/physics
DG_PHYSICS_PATH = $(DG_INCLUDED_PHYSICS_PATH)/
DG_PHYSICS_SRCS = \
    $(DG_PHYSICS_PATH)dgBody.cpp \
    $(DG_PHYSICS_PATH)dgDynamicBody.cpp \
    $(DG_PHYSICS_PATH)dgKinematicBody.cpp \
    $(DG_PHYSICS_PATH)dgBallConstraint.cpp \
    $(DG_PHYSICS_PATH)dgBilateralConstraint.cpp \
    $(DG_PHYSICS_PATH)dgBody.cpp \
    $(DG_PHYSICS_PATH)dgDynamicBody.cpp \
    $(DG_PHYSICS_PATH)dgKinematicBody.cpp \
    $(DG_PHYSICS_PATH)dgBodyMasterList.cpp \
    $(DG_PHYSICS_PATH)dgBroadPhase.cpp \
    $(DG_PHYSICS_PATH)dgCollisionBox.cpp \
    $(DG_PHYSICS_PATH)dgCollisionBVH.cpp \
    $(DG_PHYSICS_PATH)dgCollisionCapsule.cpp \
    $(DG_PHYSICS_PATH)dgCollisionChamferCylinder.cpp \
    $(DG_PHYSICS_PATH)dgCollisionCompoundFractured.cpp \
    $(DG_PHYSICS_PATH)dgCollisionCompound.cpp \
    $(DG_PHYSICS_PATH)dgCollisionCone.cpp \
    $(DG_PHYSICS_PATH)dgCollisionConvex.cpp \
    $(DG_PHYSICS_PATH)dgCollisionConvexHull.cpp \
    $(DG_PHYSICS_PATH)dgCollisionConvexPolygon.cpp \
    $(DG_PHYSICS_PATH)dgCollision.cpp \
    $(DG_PHYSICS_PATH)dgCollisionCylinder.cpp \
    $(DG_PHYSICS_PATH)dgCollisionDeformableClothPatch.cpp \
    $(DG_PHYSICS_PATH)dgCollisionDeformableSolidMesh.cpp \
    $(DG_PHYSICS_PATH)dgCollisionDeformableMesh.cpp \
    $(DG_PHYSICS_PATH)dgCollisionHeightField.cpp \
    $(DG_PHYSICS_PATH)dgCollisionInstance.cpp \
    $(DG_PHYSICS_PATH)dgCollisionMesh.cpp \
    $(DG_PHYSICS_PATH)dgCollisionNull.cpp \
    $(DG_PHYSICS_PATH)dgCollisionScene.cpp \
    $(DG_PHYSICS_PATH)dgCollisionSphere.cpp \
    $(DG_PHYSICS_PATH)dgCollisionTaperedCapsule.cpp \
    $(DG_PHYSICS_PATH)dgCollisionTaperedCylinder.cpp \
    $(DG_PHYSICS_PATH)dgCollisionUserMesh.cpp \
    $(DG_PHYSICS_PATH)dgConstraint.cpp \
    $(DG_PHYSICS_PATH)dgContact.cpp \
    $(DG_PHYSICS_PATH)dgCorkscrewConstraint.cpp \
    $(DG_PHYSICS_PATH)dgDeformableBody.cpp \
    $(DG_PHYSICS_PATH)dgDeformableContact.cpp \
    $(DG_PHYSICS_PATH)dgHingeConstraint.cpp \
    $(DG_PHYSICS_PATH)dgNarrowPhaseCollision.cpp \
    $(DG_PHYSICS_PATH)dgSlidingConstraint.cpp \
    $(DG_PHYSICS_PATH)dgUniversalConstraint.cpp \
    $(DG_PHYSICS_PATH)dgUpVectorConstraint.cpp \
    $(DG_PHYSICS_PATH)dgUserConstraint.cpp \
    $(DG_PHYSICS_PATH)dgWorld.cpp \
    $(DG_PHYSICS_PATH)dgDeformableBodiesUpdate.cpp \
    $(DG_PHYSICS_PATH)dgWorldDynamicsParallelSolver.cpp \
    $(DG_PHYSICS_PATH)dgWorldDynamicsSimpleSolver.cpp \
    $(DG_PHYSICS_PATH)dgWorldDynamicUpdate.cpp


# ******************************************************
#
# mesh gemotry 
#
# ******************************************************
DG_INCLUDED_MESH_PATH = ../../source/meshUtil
DG_MESH_PATH = $(DG_INCLUDED_MESH_PATH)/
DG_MESH_SRCS = \
    $(DG_MESH_PATH)dgMeshEffect1.cpp \
    $(DG_MESH_PATH)dgMeshEffect2.cpp \
    $(DG_MESH_PATH)dgMeshEffect3.cpp \
    $(DG_MESH_PATH)dgMeshEffect4.cpp \
    $(DG_MESH_PATH)dgMeshEffect5.cpp \
    $(DG_MESH_PATH)dgMeshEffect6.cpp 

# ******************************************************
#
# open cl 
#
# ******************************************************
DG_INCLUDED_OPENCL_PATH = ../../source/openCL
DG_OPENCL_PATH = $(DG_INCLUDED_OPENCL_PATH)/
#DG_OPENCL_SRCS = \
#   $(DG_OPENCL_PATH)dgOpencl.cpp \
#   $(DG_OPENCL_PATH)dgOpenclInstance.cpp \
#   $(DG_OPENCL_PATH)dgOpenclBroadPhase.cpp



# ******************************************************
#
# Newton engine files
#g++ -shared -o libNewton.dll libNewton.a
# ******************************************************
DG_INCLUDED_NEWTON_PATH = ../../source/newton
DG_NEWTON_PATH = $(DG_INCLUDED_NEWTON_PATH)/
DG_NEWTON_SRCS = \
    $(DG_NEWTON_PATH)Newton.cpp \
    $(DG_NEWTON_PATH)NewtonClass.cpp

# ******************************************************
#
# Allsource files
#
# ******************************************************
ALL_SRC_FILES = $(DG_SRCS) $(DG_PHYSICS_SRCS) $(DG_OPENCL_SRCS) $(DG_MESH_SRCS) $(DG_NEWTON_SRCS)
DG_OBJ_FILES = $(ALL_SRC_FILES:.cpp=.o)

COMPILER = gcc

# mingw options  gcc 4.4.2
#CPU_FLAGS = -m32 -O0 -fPIC -g -msse -msse2 -mfpmath=sse 
#CPU_FLAGS = -m32 -O0 -fPIC -g -msse -msse4.1 -mfpmath=sse 
#CPU_FLAGS = -m32 -O2 -fpic -g -msse -msse4.1 -mfpmath=sse -ffloat-store -ffast-math -freciprocal-math -funsafe-math-optimizations -fsingle-precision-constant
CPU_FLAGS = -m32 -O2 -fpic -g -msse -msse3 -msse4 -mfpmath=sse -ffloat-store -ffast-math -freciprocal-math -funsafe-math-optimizations -fsingle-precision-constant

FLAGS  = -Wall -Wno-strict-aliasing  -DPTW32_BUILD -DPTW32_STATIC_LIB -D_NEWTON_STATIC_LIB -D_MINGW_32_VER $(CPU_FLAGS) -I$(DG_INCLUDED_PATH) -I$(DG_INCLUDED_PHYSICS_PATH) -I$(DG_INCLUDED_MESH_PATH) -I$(DG_INCLUDED_OPENCL_PATH)

.SUFFIXES : .o .cpp
.cpp.o :
    $(COMPILER) $(FLAGS) -o $@ $<

# main target
engine : libNewton.a


# clean all objects target
clean :
    rm $(DG_OBJ_FILES)
    touch $(ALL_SRC_FILES)

# libraries targets
libNewton.a : $(DG_OBJ_FILES)
    ar r $@ $?
    strip -g -S -d -v libNewton.a -o libNewton.a
    cp libNewton.a ../../../packages/mingw32/libNewton.a
    cp ../../source/newton/Newton.h ../../../packages/mingw32/Newton.h
#   $(COMPILER) -shared -Wl,-soname,libNewton.dll $? -o libNewton.dll 
#   cp libNewton.dll ../../../packages/mingw32/libNewton.dll
    #sudo cp libNewton.dll /usr/lib

and the linker errors I get if I build without -c (all of the newton functionality is undefined, this is not a surprise to anyone since that's what -c is meant to do but the fact that it breaks for even the simplest of test cases implies something is wrong) 以及在没有-c的情况下生成的链接器错误(所有的牛顿功能都未定义,这对任何人来说都不奇怪,因为这是-c的本意,但是即使是最简单的测试用例,它也会中断暗示有问题)

C:\Users\Thunder\AppData\Local\Temp\cchfxWSh.o: In function `Z20CreateBackgroundBodyP11NewtonWorld':
C:\Users\Thunder\Documents\projects\libproto framework\src/ex.cpp:17: undefined reference to `_imp__NewtonCreateTreeCollision'
C:\Users\Thunder\Documents\projects\libproto framework\src/ex.cpp:20: undefined reference to `_imp__NewtonTreeCollisionBeginBuild'
C:\Users\Thunder\Documents\projects\libproto framework\src/ex.cpp:23: undefined reference to `_imp__NewtonTreeCollisionAddFace'
C:\Users\Thunder\Documents\projects\libproto framework\src/ex.cpp:26: undefined reference to `_imp__NewtonTreeCollisionEndBuild'
C:\Users\Thunder\Documents\projects\libproto framework\src/ex.cpp:29: undefined reference to `dGetIdentityMatrix()'
C:\Users\Thunder\Documents\projects\libproto framework\src/ex.cpp:30: undefined reference to `_imp__NewtonCreateDynamicBody'
C:\Users\Thunder\Documents\projects\libproto framework\src/ex.cpp:33: undefined reference to `_imp__NewtonDestroyCollision'
C:\Users\Thunder\AppData\Local\Temp\cchfxWSh.o: In function `ApplyGravity':
C:\Users\Thunder\Documents\projects\libproto framework\src/ex.cpp:45: undefined reference to `_imp__NewtonBodyGetMassMatrix'
C:\Users\Thunder\Documents\projects\libproto framework\src/ex.cpp:47: undefined reference to `_imp__NewtonBodySetForce'
C:\Users\Thunder\AppData\Local\Temp\cchfxWSh.o: In function `Z18CreateFreeFallBallP11NewtonWorld':
C:\Users\Thunder\Documents\projects\libproto framework\src/ex.cpp:53: undefined reference to `_imp__NewtonCreateSphere'
C:\Users\Thunder\Documents\projects\libproto framework\src/ex.cpp:56: undefined reference to `dGetIdentityMatrix()'
C:\Users\Thunder\Documents\projects\libproto framework\src/ex.cpp:58: undefined reference to `_imp__NewtonCreateDynamicBody'
C:\Users\Thunder\Documents\projects\libproto framework\src/ex.cpp:61: undefined reference to `_imp__NewtonBodySetForceAndTorqueCallback'
C:\Users\Thunder\Documents\projects\libproto framework\src/ex.cpp:65: undefined reference to `_imp__NewtonBodySetMassProperties'
C:\Users\Thunder\Documents\projects\libproto framework\src/ex.cpp:68: undefined reference to `_imp__NewtonBodySetLinearDamping'
C:\Users\Thunder\Documents\projects\libproto framework\src/ex.cpp:71: undefined reference to `_imp__NewtonDestroyCollision'
C:\Users\Thunder\AppData\Local\Temp\cchfxWSh.o: In function `main':
C:\Users\Thunder\Documents\projects\libproto framework\src/ex.cpp:79: undefined reference to `_imp__NewtonCreate'
C:\Users\Thunder\Documents\projects\libproto framework\src/ex.cpp:86: undefined reference to `_imp__NewtonInvalidateCache'
C:\Users\Thunder\Documents\projects\libproto framework\src/ex.cpp:90: undefined reference to `_imp__NewtonUpdate'
C:\Users\Thunder\Documents\projects\libproto framework\src/ex.cpp:93: undefined reference to `_imp__NewtonBodyGetMatrix'
C:\Users\Thunder\Documents\projects\libproto framework\src/ex.cpp:98: undefined reference to `_imp__NewtonDestroy'
collect2.exe: error: ld returned 1 exit status

Your problem is simple. 您的问题很简单。

the -c switch of gcc does only compilation step without linking and producing an executable module. gcc-c开关仅执行编译步骤,而不链接并生成可执行模块。

The fact that you instructed gcc to write an output to a file with .exe extension makes no special meaning to the gcc . 你指示的事实gcc写一个输出到文件里.exe扩展可以没有任何特殊含义的gcc

So you are just trying to execute the object file, so Winodws complains. 因此,您只是尝试执行目标文件,因此Winodws抱怨。


I assume that you mistyped the last arguments in the commands shown and they should read as hello_world.c 我假设您在显示的命令中键入了最后一个参数,但它们应读为hello_world.c

Alright, I finally narrowed down the root cause of not being able to compile or link anything. 好吧,我终于缩小了无法编译或链接任何内容的根本原因。

The cause being that the two libraries I already linked successfully are written to be C++98 compatible - these build and link fine. 原因是我已经成功链接的两个库被编写为与C ++ 98兼容-这些构建和链接很好。 However newton dynamics and box2D that are also used by my framework [which is what I'm having trouble porting] are both dependent on C++11 or higher. 但是,我的框架也使用了牛顿动力学和box2D [这是我在移植时遇到的问题]都依赖于C ++ 11或更高版本。

This took a while to find because it never occurred to me that the problem may be with just the C++11 subset of the toolchain, I noticed it entirely coincidentally when I noticed that I can't build even the simplest c++11 projects (projects only using nullptr), if I were using g++ 4.5 or older this would be expected but it's been available since 4.6 and up. 这花了一段时间才找到,因为我从来没有想过问题可能出在工具链的C ++ 11子集上,当我发现即使是最简单的c ++ 11也无法构建时,我完全偶然地注意到了这一点。项目(仅使用nullptr的项目),如果我使用的是g ++ 4.5或更早版本,则可以预期,但是从4.6及更高版本开始可用。

Thus we get to the troubleshooting, I take the hello world app (pretty standard but code included anyway) and build it using 因此,我们开始进行故障排除,我使用了hello world应用程序(相当标准,但无论如何都包含了代码),并使用

#include <iostream>

using namespace std;

int main()
{
    cout << "Hello world!" << endl;
    return 0;
}

g++.exe -Wall -fexceptions -g -O2 -c gcc530_sanitytest\\main.cpp -o obj\\Debug\\main.o g ++。exe -Wall -fexceptions -g -O2 -c gcc530_sanitytest \\ main.cpp -o obj \\ Debug \\ main.o

This works very well. 这很好。

if we then try with 如果我们再尝试

g++.exe -Wall -fexceptions -std=c++11 -g -O2 -c gcc530_sanitytest\\main.cpp -o obj\\Debug\\main.o g ++。exe -Wall -fexceptions -std = c ++ 11 -g -O2 -c gcc530_sanitytest \\ main.cpp -o obj \\ Debug \\ main.o

then we get a slew of errors 那么我们会遇到很多错误

namely: 即:

||=== Build: Debug in gcc530_sanitytest (compiler: GNU GCC Compiler) ===|
c:\mingw\include\sys\stat.h|173|error: '_dev_t' does not name a type|
c:\mingw\include\sys\stat.h|173|error: '_ino_t' does not name a type|
c:\mingw\include\sys\stat.h|173|error: '_mode_t' does not name a type|
c:\mingw\include\sys\stat.h|173|error: '_dev_t' does not name a type|
c:\mingw\include\sys\stat.h|173|error: '_off_t' does not name a type|
c:\mingw\include\sys\stat.h|173|error: 'time_t' does not name a type|
c:\mingw\include\sys\stat.h|173|error: 'time_t' does not name a type|
c:\mingw\include\sys\stat.h|173|error: 'time_t' does not name a type|
c:\mingw\include\sys\stat.h|180|error: '_dev_t' does not name a type|
c:\mingw\include\sys\stat.h|180|error: '_ino_t' does not name a type|
c:\mingw\include\sys\stat.h|180|error: '_mode_t' does not name a type|
c:\mingw\include\sys\stat.h|180|error: '_dev_t' does not name a type|
c:\mingw\include\sys\stat.h|180|error: '_off_t' does not name a type|
c:\mingw\include\sys\stat.h|180|error: 'time_t' does not name a type|
c:\mingw\include\sys\stat.h|180|error: 'time_t' does not name a type|
c:\mingw\include\sys\stat.h|180|error: 'time_t' does not name a type|
c:\mingw\include\sys\stat.h|188|error: '_dev_t' does not name a type|
c:\mingw\include\sys\stat.h|188|error: '_ino_t' does not name a type|
c:\mingw\include\sys\stat.h|188|error: '_mode_t' does not name a type|
c:\mingw\include\sys\stat.h|188|error: '_dev_t' does not name a type|
c:\mingw\include\sys\stat.h|188|error: '__off64_t' does not name a type|
c:\mingw\include\sys\stat.h|188|error: 'time_t' does not name a type|
c:\mingw\include\sys\stat.h|188|error: 'time_t' does not name a type|
c:\mingw\include\sys\stat.h|188|error: 'time_t' does not name a type|
c:\mingw\include\sys\stat.h|195|error: '_dev_t' does not name a type|
c:\mingw\include\sys\stat.h|195|error: '_ino_t' does not name a type|
c:\mingw\include\sys\stat.h|195|error: '_mode_t' does not name a type|
c:\mingw\include\sys\stat.h|195|error: '_dev_t' does not name a type|
c:\mingw\include\sys\stat.h|195|error: '__off64_t' does not name a type|
c:\mingw\include\sys\stat.h|195|error: '__time64_t' does not name a type|
c:\mingw\include\sys\stat.h|195|error: '__time64_t' does not name a type|
c:\mingw\include\sys\stat.h|195|error: '__time64_t' does not name a type|
c:\mingw\include\io.h|335|error: 'time_t' does not name a type|
c:\mingw\include\io.h|335|error: 'time_t' does not name a type|
c:\mingw\include\io.h|335|error: 'time_t' does not name a type|
c:\mingw\include\io.h|336|error: 'time_t' does not name a type|
c:\mingw\include\io.h|336|error: 'time_t' does not name a type|
c:\mingw\include\io.h|336|error: 'time_t' does not name a type|
c:\mingw\include\io.h|362|error: '__time64_t' does not name a type|
c:\mingw\include\io.h|362|error: '__time64_t' does not name a type|
c:\mingw\include\io.h|362|error: '__time64_t' does not name a type|
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar|146|error: '::fwide' has not been declared|
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar|153|error: '::mbsinit' has not been declared|
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar|198|error: '::wmemcmp' has not been declared|
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar|199|error: '::wmemcpy' has not been declared|
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar|200|error: '::wmemmove' has not been declared|
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar|201|error: '::wmemset' has not been declared|
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar|208|error: '::wmemchr' has not been declared|
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar||In function 'wchar_t* std::wmemchr(wchar_t*, wchar_t, std::size_t)':|
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar|229|error: invalid conversion from 'const wchar_t*' to 'wchar_t*' [-fpermissive]|
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwchar|228|note:   initializing argument 1 of 'wchar_t* std::wmemchr(wchar_t*, wchar_t, std::size_t)'|
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\char_traits.h|353|error: 'wmemcmp' was not declared in this scope|
||More errors follow but not being shown.|
||Edit the max errors limit in compiler options...|
||=== Build failed: 50 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|

this thus leads to the obvious conclusion that the build environment is broken, this answers the question nicely enough as far as I'm concerned - still giving serge the confirmed answer because of reminding/educating me on what -c does (although it was not the root cause). 因此,这会导致一个明显的结论,即构建环境已损坏,就我而言,这足以很好地回答问题-因为提醒/教育我-c的工作,仍然给出serge确认的答案(尽管不是)根本原因)。

perhaps this is the way mingw is designed to work but then it's broken by design (somehow I doubt that however, rather I see no reason why they would intentionally break C++11) 也许这就是mingw的设计工作方式,但后来被设计打破了(但是我对此有些怀疑,但是我认为没有理由为什么他们会故意破坏C ++ 11)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM