compile with Visual studio 2015 failed.

Create issue
Issue #162 resolved
changhao fu created an issue

System

windows 8.1

Visual studio 201 Ultimate3 update 5/ Visual studio 5 Enterprise with all stuff installed.

Cmake 3.3.0

Yasm 1.3.0/compile with latest code(Yasm worked fine)

x265 version:

change set: 24c1ee516d132194297a012e5148bdb73a66f215

I upgrade my C++ compiler to Visual studio 2015.And the compiling failed with those errors.

x265.cpp(193): error C2664: “int getopt_long(int cdecl )(void),char const **(cdecl )(void),const char ,const option ,int32_t )”: 无法将参数 1 从“int”转换为“int (__cdecl *)(void)”

x265.cpp(235): error C2664: “int getopt_long(int cdecl )(void),char const **(cdecl )(void),const char ,const option ,int32_t )”: 无法将参数 1 从“int”转换为“int (__cdecl *)(void)”

But in old visual sutdio 2013 update 5 it worked fine.

It happened when building the cli(both single lib or multi lab),but for lib it worked fine.

example:

This is the code that worked fine with Visual studio 2013 update5。

call "%VS120COMNTOOLS%\..\..\VC\vcvarsall.bat"


@cd 12bit
cmake -G "Visual Studio 12 Win64" ../../../source -DHIGH_BIT_DEPTH=ON -DEXPORT_C_API=OFF -DENABLE_SHARED=OFF -DENABLE_CLI=OFF -DMAIN12=ON -DYASM_EXECUTABLE="C:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/bin/yasm.exe"

  MSBuild /property:Configuration="Release" /target:rebuild x265.sln
  copy/y Release\x265-static.lib ..\8bit\x265-static-main12.lib


@cd ..\10bit

cmake -G "Visual Studio 12 Win64" ../../../source -DHIGH_BIT_DEPTH=ON -DEXPORT_C_API=OFF -DENABLE_SHARED=OFF -DENABLE_CLI=OFF -DYASM_EXECUTABLE="C:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/bin/yasm.exe"

  MSBuild /property:Configuration="Release" /target:rebuild x265.sln
  copy/y Release\x265-static.lib ..\8bit\x265-static-main10.lib


@cd ..\8bit
if not exist x265-static-main10.lib (
  msg "%username%" "10bit build failed"
  exit 1
)
if not exist x265-static-main12.lib (
  msg "%username%" "12bit build failed"
  exit 1
)

cmake -G "Visual Studio 12 Win64" ../../../source -DEXTRA_LIB="x265-static-main10.lib;x265-static-main12.lib" -DLINKED_10BIT=ON -DLINKED_12BIT=ON -DYASM_EXECUTABLE="C:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/bin/yasm.exe"

  MSBuild /property:Configuration="Release" /target:rebuild x265.sln

 copy/y Release\x265.exe ..\x265.exe

This is the code that failed when compiled with Visual studio 2015.

call "%VS140COMNTOOLS%\..\..\VC\vcvarsall.bat"



@cd 12bit
cmake -G "Visual Studio 14 Win64" ../../../source -DHIGH_BIT_DEPTH=ON -DEXPORT_C_API=OFF -DENABLE_SHARED=OFF -DENABLE_CLI=OFF -DMAIN12=ON -DYASM_EXECUTABLE="C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/yasm.exe"

  MSBuild /property:Configuration="Release" /target:rebuild x265.sln
  copy/y Release\x265-static.lib ..\8bit\x265-static-main12.lib


@cd ..\10bit

cmake -G "Visual Studio 14 Win64" ../../../source -DHIGH_BIT_DEPTH=ON -DEXPORT_C_API=OFF -DENABLE_SHARED=OFF -DENABLE_CLI=OFF -DYASM_EXECUTABLE="C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/yasm.exe"

  MSBuild /property:Configuration="Release" /target:rebuild x265.sln
  copy/y Release\x265-static.lib ..\8bit\x265-static-main10.lib


@cd ..\8bit
if not exist x265-static-main10.lib (
  msg "%username%" "10bit build failed"
  exit 1
)
if not exist x265-static-main12.lib (
  msg "%username%" "12bit build failed"
  exit 1
)

cmake -G "Visual Studio 14 Win64" ../../../source -DEXTRA_LIB="x265-static-main10.lib;x265-static-main12.lib" -DLINKED_10BIT=ON -DLINKED_12BIT=ON -DYASM_EXECUTABLE="C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/yasm.exe"

  MSBuild /property:Configuration="Release" /target:rebuild x265.sln

 copy/y Release\x265.exe ..\x265.exe

pause

Comments (4)

  1. Giton Xu
    It is a new MACRO named with '__argc', and defined in stdlib.h that caused this failure.
    Just replace any '__arg' in "source/compat/getopt.h" with 'arg', and everything gets right.
    
  2. Steve Borho

    getopt: remove double underscores from prototype arguments (fixes #162)

    It seems that the latest stdint.h from Microsoft defines a macro named __arg which causes our compat getopt.h to mis-compile.

    → <<cset 567f9b1263a2>>

  3. Log in to comment