Building Azure IoT Gateway SDK Solution with CMake Utility - azure

I'm trying to build a sample Azure IoT Gateway SDK project with CMake 3.71 utility for Visual Studio 2015 on Windows 10 platform. When I tried to build the project both in VS2015 Command Line and CMake GUI, respectively, I got the following error log:
Determining if the _M_AMD64 exist failed with the following output:
Change Dir: C:/Users/nanos/Documents/GitHub/project/azure-iot-gateway-sdk/build/CMakeFiles/CMakeTmp
Run Build Command:"C:/Program Files (x86)/MSBuild/14.0/bin/MSBuild.exe" "cmTC_23e97.vcxproj" "/p:Configuration=Debug" "/p:VisualStudioVersion=14.0"
Microsoft (R) Build Engine version 14.0.25420.1
Copyright (C) Microsoft Corporation. All rights reserved.
Build started 12/6/2016 1:53:03 AM.
Project "C:\Users\nanos\Documents\GitHub\project\azure-iot-gateway-sdk\build\CMakeFiles\CMakeTmp\cmTC_23e97.vcxproj" on node 1 (default targets).
PrepareForBuild:
Creating directory "cmTC_23e97.dir\Debug\".
Creating directory "C:\Users\nanos\Documents\GitHub\project\azure-iot-gateway-sdk\build\CMakeFiles\CMakeTmp\Debug\".
Creating directory "cmTC_23e97.dir\Debug\cmTC_23e97.tlog\".
InitializeBuildStatus:
Creating "cmTC_23e97.dir\Debug\cmTC_23e97.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.
ClCompile:
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\CL.exe /c /Zi /W3 /WX- /Od /Ob0 /Oy- /D WIN32 /D _WINDOWS /D _DEBUG /D "CMAKE_INTDIR=\"Debug\"" /D _MBCS /Gm- /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /Fo"cmTC_23e97.dir\Debug\\" /Fd"cmTC_23e97.dir\Debug\vc140.pdb" /Gd /TC /analyze- /errorReport:queue "C:\Users\nanos\Documents\GitHub\project\azure-iot-gateway-sdk\build\CMakeFiles\CMakeTmp\CheckSymbolExists.c"
Microsoft (R) C/C++ Optimizing Compiler Version 19.00.24215.1 for x86
Copyright (C) Microsoft Corporation. All rights reserved.
cl /c /Zi /W3 /WX- /Od /Ob0 /Oy- /D WIN32 /D _WINDOWS /D _DEBUG /D "CMAKE_INTDIR=\"Debug\"" /D _MBCS /Gm- /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /Fo"cmTC_23e97.dir\Debug\\" /Fd"cmTC_23e97.dir\Debug\vc140.pdb" /Gd /TC /analyze- /errorReport:queue "C:\Users\nanos\Documents\GitHub\project\azure-iot-gateway-sdk\build\CMakeFiles\CMakeTmp\CheckSymbolExists.c"
CheckSymbolExists.c
C:\Users\nanos\Documents\GitHub\project\azure-iot-gateway-sdk\build\CMakeFiles\CMakeTmp\CheckSymbolExists.c(7): error C2065: '_M_AMD64': undeclared identifier [C:\Users\nanos\Documents\GitHub\project\azure-iot-gateway-sdk\build\CMakeFiles\CMakeTmp\cmTC_23e97.vcxproj]
Done Building Project "C:\Users\nanos\Documents\GitHub\project\azure-iot-gateway-sdk\build\CMakeFiles\CMakeTmp\cmTC_23e97.vcxproj" (default targets) -- FAILED.
Build FAILED.
"C:\Users\nanos\Documents\GitHub\project\azure-iot-gateway-sdk\build\CMakeFiles\CMakeTmp\cmTC_23e97.vcxproj" (default target) (1) ->
(ClCompile target) ->
C:\Users\nanos\Documents\GitHub\project\azure-iot-gateway-sdk\build\CMakeFiles\CMakeTmp\CheckSymbolExists.c(7): error C2065: '_M_AMD64': undeclared identifier [C:\Users\nanos\Documents\GitHub\project\azure-iot-gateway-sdk\build\CMakeFiles\CMakeTmp\cmTC_23e97.vcxproj]
0 Warning(s)
1 Error(s)
Time Elapsed 00:00:00.65
File C:/Users/nanos/Documents/GitHub/project/azure-iot-gateway-sdk/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c:
/* */
int main(int argc, char** argv)
{
(void)argv;
#ifndef _M_AMD64
return ((int*)(&_M_AMD64))[argc];
#else
(void)argc;
return 0;
#endif
}
=========================================================================
Output from the CMake GUI here
Can someone tell me what I'm doing wrong or guide me? I have spent significant amount of hours trying to figure out how to solve the issue. I have extensively searched for solutions online, but to no success.
Thanks in advance

It seems to be related with this note:
Note: Make sure to clone the repo into a directory heirachy with less
than 20 characters (if the path is prefix\azure-iot-gateway-sdk,
prefix must be less than 20 characters). Windows has limitations on
the length of file names and placing the repo in a hierarchy deeper
than 20 characters will cause the build to fail. Our build.cmd script
throws an error if it would eventually hit this failure, but one can
hit this when manually building the project with cmake.
I kill the "project" in the directory(...Documents/GitHub/project/azure-iot-gateway-sdk/...), then it works.
So, you need shorten the length of the directory that you clone the repo into.

Related

CMake: Check existence of MSVC compiler flags

Normally, I use check_cxx_compiler_flag to check whether a given flag is recognized by the currently used compiler. However, I have run into issues with MSVC where some default flags are causing the test to fail due to incompatible flags.
MWE:
cmake_minimum_required(VERSION 3.5)
project(MWE)
include(CheckCXXCompilerFlag)
set(CMAKE_CXX_FLAGS "" CACHE INTERNAL "" FORCE)
set(CMAKE_CXX_FLAGS_DEBUG "" CACHE INTERNAL "" FORCE)
set(CMAKE_CXX_FLAGS_RELEASE "" CACHE INTERNAL "" FORCE)
set(CMAKE_CXX_FLAGS_MINSIZEREL "" CACHE INTERNAL "" FORCE)
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "" CACHE INTERNAL "" FORCE)
check_cxx_compiler_flag("/O2" FLAG_USABLE)
if (NOT FLAG_USABLE)
message(FATAL_ERROR "Flag not usable")
endif()
When this is run on Windows in a developer command prompt, the test fails and the error log contains
Run Build Command(s):C:/Program Files/Microsoft Visual Studio/2022/Enterprise/MSBuild/Current/Bin/amd64/MSBuild.exe cmTC_e3d37.vcxproj /p:Configuration=Debug /p:Platform=x64 /p:VisualStudioVersion=17.0 /v:m && MSBuild version 17.3.1+2badb37d1 for .NET Framework
Microsoft (R) C/C++ Optimizing Compiler Version 19.33.31630 for x64
Copyright (C) Microsoft Corporation. All rights reserved.
cl /c /Zi /W1 /WX- /diagnostics:column /O2 /Ob0 /D _MBCS /D FLAG_USABLE /D "CMAKE_INTDIR=\"Debug\"" /Gm- /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /Fo"cmTC_e3d37.dir\Debug\\" /Fd"cmTC_e3d37.dir\Debug\vc143.pdb" /external:W1 /Gd /TP /errorReport:queue "D:\a\cmake-compiler-flags\cmake-compiler-flags\test\build\CMakeFiles\CMakeTmp\src.cxx"
cl : command line error D8016: '/O2' and '/RTC1' command-line options are incompatible
which clearly shows that the flag is recognized, but it just does not play nicely with the /RTC1 flag, which somehow still gets added to the build.
How can I get rid of these default options (or at least all that are not essential for a build to complete), regardless of the used build configuration, so that my test really checks whether the compiler understands the given flag?
I guess your IDE - Visual Studio is adding this compilation flag. Try running Cmake from command line and the problem should be solved. In order to change VS behavior go to Solution -> Properties -> Configuration Properties -> C/C++ -> Code Generation -> Basic Runtime Checks and change the value of this flag to default or disabled.

LNK1104 error with python setup.py build

I have built Quantlib on Windows using Visual Studio 2017 and want to build Quantlib-SWIG for Python.
However, I have LNK1104: error. Namely, after launching Command Prompt from C:\QuantLib-SWIG-1.12\Python directory I receive this error:
fatal error LNK1104: cannot open file 'QuantLib-vc90-x64-mt.lib'
I saw a similar question with advise from Luigi Ballabio and KingJohnno to verify if QuantLib-vc90-x64-mt.lib file is in place & add to the path variable C:\QuantLib-SWIG-1.12.
I did the last suggestion, but I have the problem with that I have in C:\QuantLib\QuantLib-1.12\lib a QuantLib-vc141-x64-mt.lib library, i.e. not the file QuantLib-vc90-x64-mt.lib. I have created separate directory with vc141 file renamed to vc90. This did not help.
I have also read online that the problem might be with the Python specifically builded using different VS version. I have downloaded Python 2.7 builded using VS 2010 (not VS2008) and did not succeed as well.
Please see the whole terminal message here:
C:\QuantLib-SWIG-1.12\Python>cd C:\QuantLib-SWIG-1.12\Python
C:\QuantLib-SWIG-1.12\Python>set QL_DIR=C:\QuantLib\QuantLib-1.12
C:\QuantLib-SWIG-1.12\Python>set INCLUDE=C:\Boost\boost_1_66_0
C:\QuantLib-SWIG-1.12\Python>
C:\QuantLib-SWIG-1.12\Python>python setup.py build
running build
running build_py
running build_ext
building 'QuantLib._QuantLib' extension
C:\Users\user1\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\amd64\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -D__WIN32__ -DWIN32 -DNDEBUG -D_WINDOWS -DNOMINMAX -IC:\Python27vc08\include -IC:\Python27vc08\PC -IC:\QuantLib\QuantLib-1.12 -IC:\Boost\boost_1_66_0 /TpQuantLib/quantlib_wrap.cpp /Fobuild\temp.win-amd64-2.7\Release\QuantLib/quantlib_wrap.obj /GR /FD /Zm250 /EHsc /bigobj /MD
quantlib_wrap.cpp
C:\Users\user1\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Include\xutility(2472) : warning C4267: '=' : conversion from 'size_t' to 'unsigned int', possible loss of data
C:\Users\user1\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Include\xutility(2485) : see reference to function template instantiation '_OutIt std::_Copy_opt<_InIt,unsigned int*,std::forward_iterator_tag>(_InIt,_InIt,_OutIt,_InOutItCat,std::_Nonscalar_ptr_iterator_tag,std::_Range_checked_iterator_tag)' being compiled
with
[
_OutIt=unsigned int *,
_InIt=const unsigned __int64 *,
_InOutItCat=std::forward_iterator_tag
]
C:\Users\user1\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Include\xutility(2563) : see reference to function template instantiation '_OutIt std::_Copy_opt<const unsigned __int64*,_OutIt>(_InIt,_InIt,_OutIt,std::random_access_iterator_tag,std::_Nonscalar_ptr_iterator_tag,std::_Range_checked_iterator_tag)' being compiled
with
[
_OutIt=std::_Vector_iterator<std::_Vbase,std::allocator<std::_Vbase>>,
_InIt=const unsigned __int64 *
]
QuantLib/quantlib_wrap.cpp(16340) : see reference to function template instantiation 'std::_Vector_iterator<_Ty,_Alloc> std::copy<std::_Vector_const_iterator<unsigned __int64,std::allocator<unsigned __int64>>,std::_Vector_iterator<_Ty,_Alloc>>(_InIt,_InIt,_OutIt)' being compiled
with
[
_Ty=std::_Vbase,
_Alloc=std::allocator<std::_Vbase>,
_InIt=std::_Vector_const_iterator<size_t,std::allocator<size_t>>,
_OutIt=std::_Vector_iterator<std::_Vbase,std::allocator<std::_Vbase>>
]
C:\Users\user1\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\amd64\link.exe /DLL /nologo /INCREMENTAL:NO /LIBPATH:C:\Python27vc08\libs /LIBPATH:C:\Python27vc08\PCbuild\amd64 /LIBPATH:C:\Python27vc08\PC\VS9.0\amd64 /LIBPATH:C:\QuantLib\QuantLib-1.12\lib /EXPORT:init_QuantLib build\temp.win-amd64-2.7\Release\QuantLib/quantlib_wrap.obj /OUT:build\lib.win-amd64-2.7\QuantLib\_QuantLib.pyd /IMPLIB:build\temp.win-amd64-2.7\Release\QuantLib\_QuantLib.lib /MANIFESTFILE:build\temp.win-amd64-2.7\Release\QuantLib\_QuantLib.pyd.manifest /subsystem:windows /machine:x64
LINK : fatal error LNK1104: cannot open file 'QuantLib-vc90-x64-mt.lib'
error: command 'C:\\Users\\user1\\AppData\\Local\\Programs\\Common\\Microsoft\\Visual C++ for Python\\9.0\\VC\\Bin\\amd64\\link.exe' failed with exit status 1104
C:\QuantLib-SWIG-1.12\Python>
python setup.py build worked under Python 3.6.5.

"Compiling Desktop applications for the ARM platform is not supported" when building OpenSSL

I am trying to build OpenSSL from source (branch OpenSSL_1_0_1-stable) using Visual C++ (Visual Studio 2015 is installed) by following the instructions here.
When I run nmake -f ms\ntdll.mak I get the following output:
Microsoft (R) Program Maintenance Utility Version 14.00.24210.0
Copyright (C) Microsoft Corporation. All rights reserved.
Building OpenSSL
perl util/copy.pl ".\crypto\buildinf.h" "tmp32dll\buildinf.h"
Copying: ./crypto/buildinf.h to tmp32dll/buildinf.h
perl util/copy.pl ".\crypto\opensslconf.h" "inc32\openssl\opensslconf.h"
Copying: ./crypto/opensslconf.h to inc32/openssl/opensslconf.h
cl /Fotmp32dll\uplink.obj -Iinc32 -Itmp32dll /MD /Ox /O2 /Ob2 -DOPENSSL_THREADS -DDSO_WIN32 -W3 -Gs0 -GF -Gy -nologo -DOPENSSL_SYSNAME_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -D_CRT_SECURE_NO_DEPRECATE -DOPENSSL_USE_APPLINK -I. -DOPENSSL_NO_RC5 -DOPENSSL_NO_MD2 -DOPENSSL_NO_SSL2 -DOPENSSL_NO_KRB5 -DOPENSSL_NO_JPAKE -DOPENSSL_NO_WEAK_SSL_CIPHERS -DOPENSSL_NO_STATIC_ENGINE /Zi /Fdtmp32dll/lib -D_WINDLL -c ms\uplink.c
uplink.c
C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\corecrt.h(205): fatal error C1189: #error: Compiling Desktop applications for the ARM platform is not supported.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\amd64_arm\cl.EXE"' : return code '0x2'
Stop.
My ms/ntdll.mak file content:
# This makefile has been automatically generated from the OpenSSL distribution.
# This single makefile will build the complete OpenSSL distribution and
# by default leave the 'interesting' output files in .\out and the stuff
# that needs deleting in .\tmp.
# The file was generated by running 'make makefile.one', which
# does a 'make files', which writes all the environment variables from all
# the makefiles to the file call MINFO. This file is used by
# util\mk1mf.pl to generate makefile.one.
# The 'makefile per directory' system suites me when developing this
# library and also so I can 'distribute' indervidual library sections.
# The one monster makefile better suits building in non-unix
# environments.
INSTALLTOP=D:\TelegramDesktop\Libraries\openssl\Release
OPENSSLDIR=D:\TelegramDesktop\Libraries\openssl\Release\ssl
# Set your compiler options
PLATFORM=VC-WIN32
CC=cl
CFLAG= /MD /Ox /O2 /Ob2 -DOPENSSL_THREADS -DDSO_WIN32 -W3 -Gs0 -GF -Gy -nologo -DOPENSSL_SYSNAME_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -D_CRT_SECURE_NO_DEPRECATE -DOPENSSL_USE_APPLINK -I. -DOPENSSL_NO_RC5 -DOPENSSL_NO_MD2 -DOPENSSL_NO_SSL2 -DOPENSSL_NO_KRB5 -DOPENSSL_NO_JPAKE -DOPENSSL_NO_WEAK_SSL_CIPHERS -DOPENSSL_NO_STATIC_ENGINE
APP_CFLAG= /Zi /Fd$(TMP_D)/app
LIB_CFLAG= /Zi /Fd$(TMP_D)/lib -D_WINDLL
SHLIB_CFLAG=
APP_EX_OBJ=setargv.obj $(OBJ_D)\applink.obj /implib:$(TMP_D)\junk.lib
SHLIB_EX_OBJ=
# add extra libraries to this define, for solaris -lsocket -lnsl would
# be added
EX_LIBS=ws2_32.lib gdi32.lib advapi32.lib crypt32.lib user32.lib
# The OpenSSL directory
SRC_D=.
LINK_CMD=link
LFLAGS=/nologo /subsystem:console /opt:ref /debug
RSC=rc
# The output directory for everything intersting
OUT_D=out32dll
# The output directory for all the temporary muck
TMP_D=tmp32dll
# The output directory for the header files
INC_D=inc32
INCO_D=inc32\openssl
PERL=perl
CP=$(PERL) util/copy.pl
RM=del /Q
RANLIB=
MKDIR=$(PERL) util/mkdir-p.pl
MKLIB=lib /nologo
MLFLAGS= /nologo /subsystem:console /opt:ref /debug /dll
ASM=ml /nologo /Cp /coff /c /Cx /Zi
# FIPS validated module and support file locations
FIPSDIR=\usr\local\ssl\fips-2.0
BASEADDR=0xFB00000
FIPSLIB_D=$(FIPSDIR)\lib
FIPS_PREMAIN_SRC=$(FIPSLIB_D)\fips_premain.c
O_FIPSCANISTER=$(FIPSLIB_D)\fipscanister.lib
FIPS_SHA1_EXE=$(FIPSDIR)\bin\fips_standalone_sha1.exe
E_PREMAIN_DSO=fips_premain_dso
PREMAIN_DSO_EXE=$(BIN_D)\fips_premain_dso.exe
FIPSLINK=$(PERL) $(FIPSDIR)\bin\fipslink.pl
Running nmake -f ms\nt.mak produces the same error.
I am not sure why building for platform VC-WIN32 leads to an error about ARM platform. Also, I haven't find any question about this error on VS2015, only VS2013 and below, in which compiling for ARM platform is really not supported.
Any suggestions?
I've found out what was wrong:
I have run the commands in VS2015 x64 ARM Cross Tools Command Prompt instead of in VS2015 x86 Native Cross Tools Command Prompt.
Running in VS2015 x86 Native Cross Tools Command Prompt solved the issue.

Compiling C++/CX on the command line

I get the linker error fatal error C1107: could not find assembly 'platform.winmd': please specify the assembly search path using /AI or by setting the LIBPATH environment variable when I try to compile a C++/CX program on the command line.
The error is the same after I followed the instructions on this page: https://msdn.microsoft.com/en-us/library/dn769142.aspx (to summarize: run cl /ZW /EHsc source.cpp from the Developer Command Prompt for VS2015)
I also tried running vcvarsall.bat x86 store from the Developer Command Prompt for VS2015 but I still get the same error (the same error also happens when running vcvarsall.bat x86 store from a plain command prompt).
UPDATE: Apparently this bug has been fixed in VS2015 Update 1, I have not been able to test myself yet though.
As it turns out some command line parameters are missing from the documentation mentioned in the question, here is the full command line required to compile a small program:
cl /ZW
/ZW:nostdlib
/D WINAPI_FAMILY=WINAPI_FAMILY_APP
/D __WRL_NO_DEFAULT_LIB__
/Gm-
/EHsc
/MDd
/FU"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\lib\store\references\platform.winmd"
/FU"C:\Program Files (x86)\Windows Kits\10\References\Windows.Foundation.FoundationContract\1.0.0.0\Windows.Foundation.FoundationContract.winmd"
/FU"C:\Program Files (x86)\Windows Kits\10\References\Windows.Foundation.UniversalApiContract\1.0.0.0\Windows.Foundation.UniversalApiContract.winmd"
smurf.cpp
/link /SUBSYSTEM:CONSOLE
Where smurf.cpp contains:
using namespace Platform;
int main(Platform::Array<Platform::String^>^ args)
{
Platform::Details::Console::WriteLine("This is a C++/CX program.");
}
Will successfully print:
C:\Users\Mikael>smurf.exe
This is a C++/CX program.

Unable to link FFMpeg libraries in Visual studio 2012

I have been trying to link the FFMPEG static libraries to Visual studio 2012 in c++ environment. But i get the following error.
Error 1 error LNK1104: cannot open file
'avcodec.lib' C:\Users\username\Documents\Visual Studio
2012\Projects\ConsoleApplication5\ConsoleApplication5\LINK ConsoleApplication5
my lib files were located in C:\Users\username\Documents\Visual Studio 2012\Projects\ConsoleApplication5\ConsoleApplication5\ExtLib\lib
The compile seems to be fine. The command line is
/Yu"stdafx.h" /GS /W3 /Zc:wchar_t
/I"C:\Users\username\Documents\Visual Studio
2012\Projects\ConsoleApplication5\ConsoleApplication5\ExtLib\include"
/Zi /Gm /Od /sdl /Fd"x64\Debug\vc110.pdb" /fp:precise /D "WIN32" /D
"_DEBUG" /D "_CONSOLE" /D "_UNICODE" /D "UNICODE" /errorReport:prompt
/WX- /Zc:forScope /RTC1 /Gd /MTd /Fa"x64\Debug\" /EHsc /nologo
/Fo"x64\Debug\" /Fp"x64\Debug\ConsoleApplication5.pch"
The main issue seems to be at the linking stage where I have just not been able to get VS2012 to find my ffmpeg .lib files
The linker command line is below:
/OUT:"C:\Users\username\Documents\Visual Studio
2012\Projects\ConsoleApplication5\x64\Debug\ConsoleApplication5.exe"
/MANIFEST /NXCOMPAT /PDB:"C:\Users\username\Documents\Visual Studio
2012\Projects\ConsoleApplication5\x64\Debug\ConsoleApplication5.pdb"
/DYNAMICBASE "avcodec.lib" "kernel32.lib" "user32.lib" "gdi32.lib"
"winspool.lib" "comdlg32.lib" "advapi32.lib" "shell32.lib"
"ole32.lib" "oleaut32.lib" "uuid.lib" "odbc32.lib" "odbccp32.lib"
/DEBUG /MACHINE:X64 /OPT:NOREF /INCREMENTAL
/PGD:"C:\Users\username\Documents\Visual Studio
2012\Projects\ConsoleApplication5\x64\Debug\ConsoleApplication5.pgd"
/SUBSYSTEM:CONSOLE /MANIFESTUAC:"level='asInvoker' uiAccess='false'"
/ManifestFile:"x64\Debug\ConsoleApplication5.exe.intermediate.manifest"
/ERRORREPORT:PROMPT /NOLOGO
/LIBPATH:"/LIBPATH:C:\Users\username\Documents\Visual Studio
2012\Projects\ConsoleApplication5\ConsoleApplication5\ExtLib\lib"
/TLBID:1
I cant figure out why the linker cant locate my ffmpeg lib files even though they are physically located in the /LIBPATH area - c:...\vs12...\ExtLib\lib
Your LIBPATH doesn't look correct - it should be quoted like this if the path contains spaces:
/LIBPATH:"C:\Users\username\Documents\Visual Studio 2012\Projects\ConsoleApplication5\ConsoleApplication5\ExtLib\lib"
You seem to have an additional LIBPATH inside the quotes (in asterisks below)
/LIBPATH:"**/LIBPATH:**C:\Users\username\Documents\Visual Studio 2012\Projects\ConsoleApplication5\ConsoleApplication5\ExtLib\lib"
Thanks a lot! it helped in pulling out the problems. The most important step is to add the absolute path of lib files in the additional dependencies option. I have now made a comprehensive and detailed report of what steps are to be followed to get it ported. If some one needed, please find it here. [link] (http://ramu492.blogspot.in/2013/06/porting-ffmpeg-on-to-winodws7-and.html)

Resources