Unable to resolve linker error : "fatal error C1049: invalid numerical argument 'specload'"

-1

Trying to build a library using Nmake and msvc 120 from some third party libraries, existing code and built dependant library (The codebase is huge).

Below is the error i get while linking the library:

Linking CXX shared library test.dll  
fatal error C1049: invalid numerical argument 'specload'  
LINK : fatal error LNK1257: code generation failed  
LINK failed. with 1257  
NMAKE : fatal error U1077:   
'...\win32\cmake\3.1.3\bin\cmake.exe' : return code '0xffffffff'  
Stop.  
NMAKE : fatal error U1077:   
'...win32\msvc120\VC\bin\nmake.exe' : return code '0x2'  
Stop.  

I have no idea what is causing the above error.

Is there any way to gather more information on what is causing above error (the exact file that is causing this error) or is there a known solution to resolve it?

Command run : "nmake /K install"

CMakeLists.txt used:

CMAKE_MINIMUM_REQUIRED(VERSION 2.8.9)
include (GenerateExportHeader)

set(CMAKE_USER_MAKE_RULES_OVERRIDE ${CMAKE_CURRENT_SOURCE_DIR}/CMake/c_flags_override.cmake)
set(CMAKE_USER_MAKE_RULES_OVERRIDE_CXX ${CMAKE_CURRENT_SOURCE_DIR}/CMake/cxx_flags_override.cmake)

PROJECT(TestProject)

SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/CMake" "${CMAKE_MODULE_PATH}")

SET(STATIC_MSVC_RUNTIME True)

set(CMAKE_CXX_FLAGS_DEBUG_INIT "/D_DEBUG /MTd /Zi /Ob0 /Od /RTC1")
set(CMAKE_CXX_FLAGS_MINSIZEREL_INIT     "/MT /Zi /O1 /Ob1 /D NDEBUG")
set(CMAKE_CXX_FLAGS_RELEASE_INIT        "/MT /Zi /O2 /Ob2 /D NDEBUG")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "/MT /Zi /O2 /Ob1 /D NDEBUG")
set(CMAKE_SHARED_LINKER_FLAGS "/OPT:NOREF /SAFESEH:NO /INCREMENTAL:NO")
set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /DEBUG /OPT:REF /OPT:ICF")

FIND_PACKAGE(TestDependency REQUIRED)
FIND_PACKAGE(PNG REQUIRED)
FIND_PACKAGE(SSL REQUIRED)
FIND_PACKAGE(FREEGLUT REQUIRED)
FIND_PACKAGE(OPENCV REQUIRED)

SET (SOURCES "${SOURCES}"
    "BaseTest.cpp"
    "StreamFlow.cpp"
    "UIManager.cpp"
    )

include_directories(.)
INCLUDE_DIRECTORIES(
    "${TestDependency_INCLUDE}"
    "${PNG_INCLUDE}"
    "${FREEGLUT_INCLUDE}"
    "${OPENCV_INCLUDE}"
    "$ENV{JAVA_HOME}/include"
    "$ENV{JAVA_HOME}/include/win32"
    "$ENV{TestDependencyInstallBase/../TestDependency/core"
    "$ENV{TEST_DIR}"
    "$ENV{TEST_DIR}/Tests"
)

add_subdirectory("$ENV{TEST_DIR}" Test)

add_compiler_export_flags()

TARGET_LINK_LIBRARIES(test
    ${TestDependency_LIBRARY}
    ${LIBPNG_LIBRARY}
    ${ZLIB_LIBRARY}
        ${SSL_LIBRARY}
        ${FREEGLUT_LIBRARY}
        ${OPENCV_CORE_LIBRARY}
        ${OPENCV_HIGHGUI_LIBRARY}
        ${OPENCV_IMGPROC_LIBRARY}
        ${EAY_LIBRARY}
        ws2_32
        rpcrt4
        Winmm
        Dsound
    )

SET (OPENCV_DLL_64 thirdparty/Opencv/bin/x64/vc12/Release/opencv_core2411.dll thirdparty/Opencv/bin/x64/vc12/Release/opencv_highgui2411.dll thirdparty/Opencv/bin/x64/vc12/Release/opencv_imgproc2411.dll)

IF (${CMAKE_SYSTEM_PROCESSOR} MATCHES "x64")
    MESSAGE("using x64.")
    INSTALL(TARGETS test DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/Release/x64 CONFIGURATIONS Release)
    INSTALL(FILES 
        thirdparty/freeglut/bin/x64/freeglut.dll
        ${OPENCV_DLL_64}
        build/x86_64/Release/test.pdb
        DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/Release/x64)
ENDIF()

Note: This worked previously but after changes to TestDependancy code, it started giving this error.

c++
cmake
linker-errors
nmake
msvc12
asked on Stack Overflow Aug 14, 2018 by moooni moon • edited Aug 14, 2018 by moooni moon

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0