“1> cl:命令行错误D8021:无效的数字参数'/ Wno-deprecated'”Erro

时间:2012-12-05 06:29:37

标签: qt visual-c++ compiler-construction cmake vtk

此错误:

"1>cl : Command line error D8021: invalid numeric argument '/Wno-deprecated'" 
在MSVC编译器构建VTK + Qt项目时发生

。我认为标志设置存在一些问题。以下是我的CMakeList.txt

cmake_minimum_required(VERSION 2.8)
PROJECT(QtImageViewer)

IF(NOT VTK_BINARY_DIR)  
FIND_PACKAGE(VTK)
    INCLUDE(${VTK_USE_FILE})
ENDIF(NOT VTK_BINARY_DIR)
SET(QT_QMAKE_EXECUTABLE ${VTK_QT_QMAKE_EXECUTABLE} CACHE FILEPATH "")
SET(QT_MOC_EXECUTABLE ${VTK_QT_MOC_EXECUTABLE} CACHE FILEPATH "")
SET(QT_UIC_EXECUTABLE ${VTK_QT_UIC_EXECUTABLE} CACHE FILEPATH "")

FIND_PACKAGE(Qt4 REQUIRED)
INCLUDE(${QT_USE_FILE})
SET (SRCS main.cxx)
INCLUDE_DIRECTORIES( ${QT_INCLUDE_DIR} ${QT_QTGUI_INCLUDE_DIR} ${QT_QTCORE_INCLUDE_DIR})

ADD_EXECUTABLE( qtimageviewer MACOSX_BUNDLE ${SRCS})

TARGET_LINK_LIBRARIES( qtimageviewer
  QVTK
  ${QT_LIBRARIES}
  vtkRendering
  vtkGraphics
  vtkIO
  vtkCommon
)

请解释如何解决此错误?

1 个答案:

答案 0 :(得分:4)

通过检查项目属性(配置属性 - > C / C ++ - >命令行),似乎有一些不需要的标志看起来像:

“/ Zm1000 -Wno-deprecated -mwin32 -mthreads / bigobj”

只需删除标记的标记,编译就可以正确完成。