7

This error:

"1>cl : Command line error D8021: invalid numeric argument '/Wno-deprecated'" 

occurring while building VTK + Qt project by MSVC compiler. I think there is some issue with flag settings. following is my 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
)

Please explain how to solve this error?

QT-ITK-VTK-Help
  • 548
  • 2
  • 6
  • 19
  • Q: Did you follow the install instructions for configuring QVTK to compile under Visual Studio? Q: Exactly which version of Visual studio are you using? ALSO: [CMake Invalid Numeric Argument](http://stackoverflow.com/questions/2274006/cmake-invalid-numeric-argument-wextra) – paulsm4 Dec 05 '12 at 06:32
  • I compiled VTK as instruction on this link http://www.vtk.org/Wiki/VTK/Building/VisualStudio and I am using visual studio 2008 compiler – QT-ITK-VTK-Help Dec 05 '12 at 06:44

1 Answers1

7

By examining project properties (Configuration Properties-> C/C++ ->Command Line) it appears that there are some unwanted flags that look like:

"/Zm1000 -Wno-deprecated -mwin32 -mthreads /bigobj"

just remove the marked flag, compilation completes correctly.

Those seem to be MingW, gcc or clang compiler flags, not supported by MSVC.

Top-Master
  • 7,611
  • 5
  • 39
  • 71
Heisenberg
  • 78
  • 1
  • 5