Command line error d8021 invalid numeric argument error

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 set...

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?

asked Dec 5, 2012 at 6:29

QT-ITK-VTK-Help's user avatar

QT-ITK-VTK-HelpQT-ITK-VTK-Help

5482 gold badges6 silver badges19 bronze badges

2

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's user avatar

Top-Master

6,6705 gold badges34 silver badges59 bronze badges

answered Apr 9, 2013 at 10:22

Heisenberg's user avatar

I am trying to install Detectron on my Windows 10 PC with a GTX 1070.

I followed the directions.

DETECTRON=/path/to/clone/detectron

  1. git clone https://github.com/facebookresearch/detectron $DETECTRON
  2. pip install -r $DETECTRON/requirements.txt
  3. cd $DETECTRON && make

on the make step, I get the following error:

C:Usersandcy$DETECTRON>make
python setup.py develop --user
running develop
running egg_info
writing Detectron.egg-infoPKG-INFO
writing top-level names to Detectron.egg-infotop_level.txt
writing dependency_links to Detectron.egg-infodependency_links.txt
reading manifest file 'Detectron.egg-infoSOURCES.txt'
writing manifest file 'Detectron.egg-infoSOURCES.txt'
running build_ext
building 'detectron.utils.cython_bbox' extension
C:UsersandcyAppDataLocalProgramsCommonMicrosoftVisual C++ for Python9.0VCBinamd64cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -IC:UsersandcyAppDataLocalContinuumanaconda2libsite-packagesnumpycoreinclude -IC:UsersandcyAppDataLocalContinuumanaconda2include -IC:UsersandcyAppDataLocalContinuumanaconda2PC /Tcdetectron/utils/cython_bbox.c /Fobuildtemp.win-amd64-2.7Releasedetectron/utils/cython_bbox.obj -Wno-cpp
cl : Command line error D8021 : invalid numeric argument '/Wno-cpp'
error: command 'C:\Users\andcy\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\amd64\cl.exe' failed with exit status 2
make: *** [dev] Error 1

I searched the Internet for: cl : Command line error D8021 : invalid numeric argument '/Wno-cpp'.

I found a number of solutions:

  1. Installation on Windows Command line error D8021 : invalid numeric argument ‘/Wno-cpp’ CharlesShang/FastMaskRCNN#173
  2. invalid numeric argument ‘/Wno-cpp’ cocodataset/cocoapi#51

The solution being:

First go to cocoapiPythonAPIsetup.py and change a line from from:
extra_compile_args=['-Wno-cpp', '-Wno-unused-function', '-std=c99'],
to extra_compile_args={'gcc': ['/Qstd=c99']},

It did not work because of TypeError: can only concatenate list (not "dict") to list make:.

Further down in the comments, @TonyNgo1 mentions that he also gets the error and suggests removing the line entirely. It works.

However, I am still unable to make Detectron.

Any ideas or references?

2227 Warning(s)
0 Error(s)

Time Elapsed 00:05:28.53
«Caffe2 built successfully»

  • Operating system: ?

  • Compiler version: ?

  • CUDA version: 9.2

  • cuDNN version: ?

  • NVIDIA driver version: 398.36

  • PYTHONPATH environment variable: ?
    I do not see an environment variable with this name when I look under my environment variables.

  • python --version output:

C:Usersandcy>python --version
Python 2.7.14 :: Anaconda custom (64-bit)
  • Anything else that seems relevant: ?

RRS feed

  • Remove From My Forums
  • Question

  • i want compile caffe2 lib as static library with additional options /WHOLEARCHIVE but when try to compile this error occur
    :

    >------ Build started: Project: caffe2, Configuration: Release x64 ------
    1>cl : Command line error D8021: invalid numeric argument '/WHOLEARCHIVE'
    ========== Build: 0 succeeded, 1 failed, 6 up-to-date, 0 skipped ==========

    Additional Options
    in visual studio : 

    %(AdditionalOptions) /bigobj /bigobj /WHOLEARCHIVE

All replies

  • /bigobj is a compiler option.  It should be set in the «Additional Options» for the command line in the C/C++ Project properties node

    /WHOLEARCHIVE is a linker option.  It should be set in «Additonal Options» for the command line in the Linker Project properties node.

    I cannot tell from the information where these options have been set as «Additional Options» (compiler or linker) but in any event, they don’t belong together.

    • Marked as answer by

      Tuesday, October 24, 2017 11:53 AM

    • Unmarked as answer by
      Aligolos
      Tuesday, October 24, 2017 2:20 PM

  • i add this option like below image but linker show this message :

    LINK : warning LNK4044: unrecognized option '/WHOLEARCHIVE'; ignored

  • The WHOLEARCHIVE option is used to link all of the modules contained in a library into an executable, even if the executable does not reference functions contained in those modules.  The option is used when linking an EXE, not when creating a library.

    For example, if you were building Foo.exe and wanted it to contain all of the code contained in the modules of library Foolib.lib then you would specify /WHOLEARCHIVE:Foolib in the linker options for Foo.exe.

    • Proposed as answer by
      Baron Bi
      Thursday, October 26, 2017 9:22 AM

  • ohhh god, what is that for? 

  • Hi Michael,

    thanks for posting here.

    >>i add this option like below image but linker show this message :

    You need to use this command in your project property->Linker->Command Line->Additional Options(if your library project is a standard c++ project).

    The /WHOLEARCHIVE option forces the linker to include every object file from either a specified static library, or if no library is specified, from all static libraries specified to the LINK command. To specify the /WHOLEARCHIVE option for multiple libraries,
    you can use more than one /WHOLEARCHIVE switch on the linker command line. By default, the linker includes object files in the linked output only if they export symbols referenced by other object files in the executable. The /WHOLEARCHIVE option makes the
    linker treat all object files archived in a static library as if they were specified individually on the linker command line.

    For more information, please refer to this document below.

    https://msdn.microsoft.com/en-us/library/mt732963.aspx?f=255&MSPPError=-2147217396

    Hope this could be help of you.

    Best Regards,

    Sera Yu


    MSDN Community Support
    Please remember to click «Mark as Answer» the responses that resolved your issue, and to click «Unmark as Answer» if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to
    MSDN Support, feel free to contact MSDNFSF@microsoft.com.


TEMPLATE = app

# make sure we do not accidentally #include files placed in 'resources'
CONFIG += no_include_pwd

# checks to ensure that the Stanford C++ library and its associated
# Java back-end are both present in this project
!exists($$PWD/lib/StanfordCPPLib/private/version.h) {
    message(*** Stanford C++ library not found!)
    message(*** This project cannot run without the folder lib/StanfordCPPLib/.)
    message(*** Place that folder into your project and try again.)
    error(Exiting.)
}
!exists($$PWD/lib/spl.jar) {
    message(*** Stanford Java back-end library 'spl.jar' not found!)
    message(*** This project cannot run without spl.jar present.)
    message(*** Place that file into your lib/ folder and try again.)
    error(Exiting.)
}

win32 {
    !exists($$PWD/lib/addr2line.exe) {
        message(*** Stanford C++ library support file 'addr2line.exe' not found!)
        message(*** Our library needs this file present to produce stack traces.)
        message(*** Place that file into your lib/ folder and try again.)
        error(Exiting.)
    }
}

# include various source .cpp files and header .h files in the build process
# (student's source code can be put into project root, or src/ subfolder)
SOURCES += $$PWD/lib/StanfordCPPLib/*.cpp
SOURCES += $$PWD/lib/StanfordCPPLib/stacktrace/*.cpp
exists($$PWD/src/*.cpp) {
    SOURCES += $$PWD/src/*.cpp
}
exists($$PWD/src/test/*.cpp) {
    SOURCES += $$PWD/src/test/*.cpp
}
exists($$PWD/*.cpp) {
    SOURCES += $$PWD/*.cpp
}

HEADERS += $$PWD/lib/StanfordCPPLib/*.h
HEADERS += $$PWD/lib/StanfordCPPLib/private/*.h
HEADERS += $$PWD/lib/StanfordCPPLib/stacktrace/*.h
exists($$PWD/src/*.h) {
    HEADERS += $$PWD/src/*.h
}
exists($$PWD/src/test/*.h) {
    HEADERS += $$PWD/src/test/*.h
}
exists($$PWD/*.h) {
    HEADERS += $$PWD/*.h
}

# set up flags for the C++ compiler
# (In general, many warnings/errors are enabled to tighten compile-time checking.
# A few overly pedantic/confusing errors are turned off for simplicity.)
QMAKE_CXXFLAGS += -std=c++11
QMAKE_CXXFLAGS += -Wall
#QMAKE_CXXFLAGS += -Wextra
QMAKE_CXXFLAGS += -Wreturn-type
QMAKE_CXXFLAGS += -Werror=return-type
QMAKE_CXXFLAGS += -Wunreachable-code
QMAKE_CXXFLAGS += -Wno-missing-field-initializers
QMAKE_CXXFLAGS += -Wno-sign-compare
QMAKE_CXXFLAGS += -Wno-write-strings

unix:!macx {
    QMAKE_CXXFLAGS += -rdynamic
    QMAKE_LFLAGS += -rdynamic
    QMAKE_LFLAGS += -Wl,--export-dynamic
    QMAKE_CXXFLAGS += -Wl,--export-dynamic
}
!win32 {
    QMAKE_CXXFLAGS += -Wno-dangling-field
    QMAKE_CXXFLAGS += -Wno-unused-const-variable
    LIBS += -ldl
}

# increase system stack size (helpful for recursive programs)
win32 {
    QMAKE_LFLAGS += -Wl,--stack,536870912
    LIBS += -lDbghelp
    LIBS += -lbfd
    #LIBS += -liberty
    LIBS += -limagehlp
}
macx {
    #QMAKE_LFLAGS += -Wl,-stack_size,0x2000000
}

# set up flags used internally by the Stanford C++ libraries
DEFINES += SPL_CONSOLE_X=999999
DEFINES += SPL_CONSOLE_Y=999999
DEFINES += SPL_CONSOLE_WIDTH=750
DEFINES += SPL_CONSOLE_HEIGHT=500
DEFINES += SPL_CONSOLE_FONTSIZE=14
DEFINES += SPL_CONSOLE_ECHO
DEFINES += SPL_CONSOLE_EXIT_ON_CLOSE
DEFINES += SPL_VERIFY_JAVA_BACKEND_VERSION
DEFINES += SPL_PROJECT_VERSION=20141113

# directories examined by Qt Creator when student writes an #include statement
INCLUDEPATH += $$PWD/lib/StanfordCPPLib/
INCLUDEPATH += $$PWD/lib/StanfordCPPLib/private/
INCLUDEPATH += $$PWD/lib/StanfordCPPLib/stacktrace/
INCLUDEPATH += $$PWD/src/
INCLUDEPATH += $$PWD/
exists($$PWD/src/test/*.h) {
    INCLUDEPATH += $$PWD/src/test/
}

# build-specific options (debug vs release)
CONFIG(release, debug|release) {
    # make 'release' target be statically linked so it is a stand-alone executable
    # (this code comes from Rasmus Rygaard)
    QMAKE_CXXFLAGS += -O2
    macx {
        QMAKE_POST_LINK += 'macdeployqt $${OUT_PWD}/$${TARGET}.app && rm $${OUT_PWD}/*.o && rm $${OUT_PWD}/Makefile'
    }
    unix:!macx {
        QMAKE_POST_LINK += 'rm $${OUT_PWD}/*.o && rm $${OUT_PWD}/Makefile'
        QMAKE_LFLAGS += -static
        QMAKE_LFLAGS += -static-libgcc
        QMAKE_LFLAGS += -static-libstdc++
    }
    win32 {
        TARGET_PATH = $${OUT_PWD}/release/$${TARGET}.exe
        TARGET_PATH ~= s,/,\,g

        OUT_PATH = $${OUT_PWD}/
        OUT_PATH ~= s,/,\,g

        REMOVE_DIRS += $${OUT_PWD}/release
        REMOVE_DIRS += $${OUT_PWD}/debug
        REMOVE_FILES += $${OUT_PWD}/Makefile
        REMOVE_FILES += $${OUT_PWD}/Makefile.Debug
        REMOVE_FILES += $${OUT_PWD}/Makefile.Release
        REMOVE_FILES += $${OUT_PWD}/object_script.$${TARGET}.Release
        REMOVE_FILES += $${OUT_PWD}/object_script.$${TARGET}.Debug
        REMOVE_DIRS ~= s,/,\,g
        REMOVE_FILES ~= s,/,\,g

        QMAKE_LFLAGS += -static
        QMAKE_LFLAGS += -static-libgcc
        QMAKE_LFLAGS += -static-libstdc++
        QMAKE_POST_LINK += 'move $${TARGET_PATH} $${OUT_PWD} 
            && rmdir /s /q $${REMOVE_DIRS} 
            && del $${REMOVE_FILES}'
    }
}
CONFIG(debug, debug|release) {
    # make 'debug' target use no optimization, generate debugger symbols,
    # and catch/print any uncaught exceptions thrown by the program
    QMAKE_CXXFLAGS += -O0
    QMAKE_CXXFLAGS += -g3
    QMAKE_CXXFLAGS += -ggdb3
    DEFINES += SPL_CONSOLE_PRINT_EXCEPTIONS
}

# This function copies the given files to the destination directory.
# Used to place important resources from res/ and spl.jar into build/ folder.
defineTest(copyToDestdir) {
    files = $$1

    for(FILE, files) {
        DDIR = $$OUT_PWD

        # Replace slashes in paths with backslashes for Windows
        win32:FILE ~= s,/,\,g
        win32:DDIR ~= s,/,\,g

        !win32 {
            copyResources.commands += cp -r '"'$$FILE'"' '"'$$DDIR'"' $$escape_expand(\n\t)
        }
        win32 {
            copyResources.commands += xcopy '"'$$FILE'"' '"'$$DDIR'"' /e /y $$escape_expand(\n\t)
        }
    }
    export(copyResources.commands)
}

!win32 {
    copyToDestdir($$files($$PWD/res/*))
    copyToDestdir($$files($$PWD/lib/*.jar))
    exists($$PWD/*.txt) {
        copyToDestdir($$files($$PWD/*.txt))
    }
}
win32 {
    copyToDestdir($$PWD/res)
    copyToDestdir($$PWD/lib/*.jar)
    copyToDestdir($$PWD/lib/addr2line.exe)
    exists($$PWD/*.txt) {
        copyToDestdir($$PWD/*.txt)
    }
}

copyResources.input += $$files($$PWD/lib/*.jar)
win32 {
    copyResources.input += $$files($$PWD/lib/addr2line.exe)
}
copyResources.input += $$files($$PWD/res/*)
exists($$PWD/*.txt) {
    copyResources.input += $$files($$PWD/*.txt)
}

OTHER_FILES += $$files(res/*)
exists($$PWD/*.txt) {
    OTHER_FILES += $$files($$PWD/*.txt)
}

QMAKE_EXTRA_TARGETS += copyResources
POST_TARGETDEPS += copyResources

# Platform-specific project settings to reduce warnings on Mac OS X systems
macx {
    cache()
    QMAKE_MAC_SDK = macosx
}

# ================== END GENERAL PROJECT SETTINGS ==================

# settings specific to CS 106 B/X auto-grading programs; do not modify
exists($$PWD/lib/autograder/*.cpp) {
    # include the various autograder source code and libraries in the build process
    SOURCES += $$PWD/lib/autograder/*.cpp
    HEADERS += $$PWD/lib/autograder/*.h
    INCLUDEPATH += $$PWD/lib/StanfordCPPLib/private/
    INCLUDEPATH += $$PWD/lib/autograder/
    DEFINES += SPL_AUTOGRADER_MODE

    # a check to ensure that required autograder resources are present in this project
    !exists($$PWD/res/autograder/pass.gif) {
        message(*** Stanford library cannot find its image files pass.gif, fail.gif, etc.!)
        message(*** This project cannot run without those images present.)
        message(*** Place those files into your res/autograder/ folder and try again.)
        error(Exiting.)
    }

    # copy autograder resource files into build folder
    copyResources.input += $$files($$PWD/res/autograder/*)
    OTHER_FILES += $$files(res/autograder/*)

    !win32 {
        LIBS += -lpthread
        copyToDestdir($$files($$PWD/res/autograder/*))
    }
    win32 {
        copyToDestdir($$PWD/res/autograder)
    }

    # copy source code into build folder so it can be analyzed by style checker
    exists($$PWD/src/*.cpp) {
        copyResources.input += $$files($$PWD/src/*.cpp)
        copyToDestdir($$files($$PWD/src/*.cpp))
    }
    exists($$PWD/*.cpp) {
        copyResources.input += $$files($$PWD/*.cpp)
        copyToDestdir($$files($$PWD/*.cpp))
    }
    exists($$PWD/src/*.h) {
        copyResources.input += $$files($$PWD/src/*.h)
        copyToDestdir($$files($$PWD/src/*.h))
    }
    exists($$PWD/*.h) {
        copyResources.input += $$files($$PWD/*.h)
        copyToDestdir($$files($$PWD/*.h))
    }
}

Есть проект, использующий библиотеки qt. До этого он спокойно запускался под visual studio (19/22 preview). Но вчера почему-то перестал, помогите решить проблему.
Развёрнутый вариант ошибки (вывод сборки):

/nologo /TP -DMINGW_HAS_SECURE_API=1 -DQT_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB -DUNICODE -DWIN32 -DWIN64 -D_ENABLE_EXTENDED_ALIGNED_STORAGE -D_UNICODE -D_WIN32_WINNT=0x0601 -D_WIN64 -ID:fictional-systemoutbuildx64-Debug -ID:fictional-system -ID:fictional-systemoutbuildx64-Debugfict_autogeninclude -external:I C:Qt6.1.3mingw81_64includeQtWidgets -external:I C:Qt6.1.3mingw81_64include -external:I C:Qt6.1.3mingw81_64includeQtCore -external:I C:Qt6.1.3mingw81_64mkspecswin32-g++ -external:I C:Qt6.1.3mingw81_64includeQtGui -external:W0 /DWIN32 /D_WINDOWS /GR /EHsc /Zi /Ob0 /Od /RTC1 -MDd -Wno-error=invalid-offsetof -std:c++17 /showIncludes /FoCMakeFilesfict.dirmain.cpp.obj /FdCMakeFilesfict.dir /FS -c D:fictional-systemmain.cpp

Всё что вывело окно сборки:

>------ Сборка запущено: проект: CMakeLists, конфигурация: Debug ------
  [1/3] Building CXX object CMakeFilesfict.dirmain.cpp.obj
  FAILED: CMakeFiles/fict.dir/main.cpp.obj 
  C:PROGRA~1MICROS~22022PreviewVCToolsMSVC1432~1.313binHostx64x64cl.exe  /nologo /TP -DMINGW_HAS_SECURE_API=1 -DQT_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB -DUNICODE -DWIN32 -DWIN64 -D_ENABLE_EXTENDED_ALIGNED_STORAGE -D_UNICODE -D_WIN32_WINNT=0x0601 -D_WIN64 -ID:fictional-systemoutbuildx64-Debug -ID:fictional-system -ID:fictional-systemoutbuildx64-Debugfict_autogeninclude -external:I C:Qt6.1.3mingw81_64includeQtWidgets -external:I C:Qt6.1.3mingw81_64include -external:I C:Qt6.1.3mingw81_64includeQtCore -external:I C:Qt6.1.3mingw81_64mkspecswin32-g++ -external:I C:Qt6.1.3mingw81_64includeQtGui -external:W0 /DWIN32 /D_WINDOWS /GR /EHsc /Zi /Ob0 /Od /RTC1 -MDd -Wno-error=invalid-offsetof -std:c++17 /showIncludes /FoCMakeFilesfict.dirmain.cpp.obj /FdCMakeFilesfict.dir /FS -c D:fictional-systemmain.cpp
D:fictional-systemoutbuildx64-Debugcl : командная строка error D8021: недопустимый числовой аргумент "/Wno-error=invalid-offsetof"
  [2/3] Building CXX object CMakeFilesfict.dirfict_autogenmocs_compilation.cpp.obj
  FAILED: CMakeFiles/fict.dir/fict_autogen/mocs_compilation.cpp.obj 
  C:PROGRA~1MICROS~22022PreviewVCToolsMSVC1432~1.313binHostx64x64cl.exe  /nologo /TP -DMINGW_HAS_SECURE_API=1 -DQT_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB -DUNICODE -DWIN32 -DWIN64 -D_ENABLE_EXTENDED_ALIGNED_STORAGE -D_UNICODE -D_WIN32_WINNT=0x0601 -D_WIN64 -ID:fictional-systemoutbuildx64-Debug -ID:fictional-system -ID:fictional-systemoutbuildx64-Debugfict_autogeninclude -external:I C:Qt6.1.3mingw81_64includeQtWidgets -external:I C:Qt6.1.3mingw81_64include -external:I C:Qt6.1.3mingw81_64includeQtCore -external:I C:Qt6.1.3mingw81_64mkspecswin32-g++ -external:I C:Qt6.1.3mingw81_64includeQtGui -external:W0 /DWIN32 /D_WINDOWS /GR /EHsc /Zi /Ob0 /Od /RTC1 -MDd -Wno-error=invalid-offsetof -std:c++17 /showIncludes /FoCMakeFilesfict.dirfict_autogenmocs_compilation.cpp.obj /FdCMakeFilesfict.dir /FS -c D:fictional-systemoutbuildx64-Debugfict_autogenmocs_compilation.cpp
D:fictional-systemoutbuildx64-Debugcl : командная строка error D8021: недопустимый числовой аргумент "/Wno-error=invalid-offsetof"
  ninja: build stopped: subcommand failed.

CMake:

cmake_minimum_required(VERSION 3.19)
project(FictionalSystem)
set(username $ENV{USERNAME})

#set(CMAKE_CXX_COMPILER "C:/Program Files/JetBrains/CLion 2021.3.3/bin/mingw/bin/g++.exe")

if (WIN32)
    if (username MATCHES "Вячеслав")
    set(CMAKE_CXX_STANDARD 17)
    set(CMAKE_INCLUDE_CURRENT_DIR ON)
    set(CMAKE_PREFIX_PATH "C:\Qt\6.1.3\mingw81_64\lib\cmake")
    set(EXECUTABLE_OUTPUT_PATH "..\..\..\release")
    endif (username MATCHES "Вячеслав")
    message("check")
else()
    set(CMAKE_PREFIX_PATH "~/Qt/6.1.3/mingw81_64/lib/cmake")
endif (WIN32)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_INCLUDE_CURRENT_DIR ON)

find_package(Qt6Widgets REQUIRED)

set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTORCC ON)

# Build and link
add_library (
    PICS 
    "src/pics/set/pics.h"
    "src/pics/set/lbp.h"
)

add_library (
    NET
    #"src/net/templates/algen.h"
    #"src/net/countmask.h"
    #"src/net/structure/prefim.h"
    #"src/net/templates/create_w.h"
)
add_library(
    LEARNING
    "src/learning/adaboost.h"
  #  "src/learning/countmask.h"
   # "src/learning/create_w.h"
)
add_library(
    STRUCT
    "src/struct/algen.h"
    "src/struct/prefim.h"
    "src/struct/shab.h"
    "src/struct/sigmoid.h"
)

add_library(
    SRC
    "src/learning.h"
    "src/net.h"
    "src/pics_get.h"
    "src/pics_set.h"
)
add_executable(fict main.cpp ${SRC})

target_link_libraries(fict Qt6::Widgets)


  • Вопрос задан

    17 мар. 2022

  • 294 просмотра

Пригласить эксперта

Строка

set(CMAKE_PREFIX_PATH "C:\Qt\6.1.3\mingw81_64\lib\cmake")

намекает, что вы пытаетесь подключить бинарники, скомпилированные при помощи mingw, к проекту, собираемому при помощи msvc. Это в любом случае не сработает, ABI несовместимы.

В данном случае это также может быть причиной ошибки, т.к. вы подключаете файлы конфигурации cmake, которые содержат флаги компилятора, которые при сборке были прописаны как публичная зависимость. Флаги от mingw, естественно, недопустимы для msvc.

Проще говоря, либо установите версию Qt, соответствующую вашему компилятору, либо установите msys2, и используйте mingw + Qt из пакетов (но для mingw нет QWebEngine).


  • Показать ещё
    Загружается…

09 февр. 2023, в 11:42

7000 руб./за проект

09 февр. 2023, в 11:23

1500 руб./за проект

09 февр. 2023, в 10:11

1500 руб./в час

Минуточку внимания

Понравилась статья? Поделить с друзьями:
  • Com apple diskmanagement disenter ошибка 119930872
  • Com android volley client error
  • Com android systemui произошла ошибка как исправить
  • Com android settings произошла ошибка как исправить asus
  • Com android settings остановился как исправить