Я пытаюсь скомпилировать openCTM, используя VC12 в x64.
OpenCTM скачивается с: openctm-1.0.3-src.zip
Для компиляции я запускаю: nmake / f Makefile.msvc
Для настройки среды я использую следующий bat-файл:
@rem Setting environment for using Microsoft Visual Studio x86/x64 tools.
@echo off
@if "%1"=="vc11_x86" goto set_vc11_x86
@if "%1"=="vc11_x64" goto set_vc11_x64
@if "%1"=="vc12_x64" goto set_vc12_x64
@if "%1"=="" goto error
:set_vc11_x86
@echo Setting environment for using Microsoft Visual Studio 2011 x86 tools.
set INCLUDE=^
C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include;^
C:\Program Files (x86)\Windows Kits\8.1\Include\um;^
C:\Program Files (x86)\Windows Kits\8.1\Include\shared;^
C:\Program Files (x86)\Windows Kits\8.1\Include\WinRT;
set LIB=^
C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\lib\;^
C:\Program Files (x86)\Windows Kits\8.1\Lib\winv6.3\um\x86\;^
C:\Program Files (x86)\Windows Kits\8.0\Lib\Win8\um\x86\;set PATH=^
C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;^
%SystemRoot%\system32;^
%SystemRoot%;^
%SystemRoot%\System32\Wbem;^
%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;^
C:\MinGW\bin\;^
C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;^
C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.0\;^
C:\Qt\Qt5.3.1\5.3\msvc2013_64_opengl\bin\;^
C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\;^
C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\;^
C:\Program Files (x86)\Windows Kits\8.1\bin\x86\;
goto test_bin_locations
:set_vc11_x64
@echo Setting environment for using Microsoft Visual Studio 2011 x64 tools.
set INCLUDE=^
C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include;^
C:\Program Files (x86)\Windows Kits\8.1\Include\um;^
C:\Program Files (x86)\Windows Kits\8.1\Include\shared;^
C:\Program Files (x86)\Windows Kits\8.1\Include\WinRT;
set LIB=^
C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\lib\;^
C:\Program Files (x86)\Windows Kits\8.1\Lib\winv6.3\um\x86\;^
C:\Program Files (x86)\Windows Kits\8.0\Lib\Win8\um\x86\;
set PATH=^
C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;^
%SystemRoot%\system32;^
%SystemRoot%;^
%SystemRoot%\System32\Wbem;^
%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;^
C:\MinGW\bin\;^
C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;^
C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.0\;^
C:\Qt\Qt5.3.1\5.3\msvc2013_64_opengl\bin\;^
C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\x86_amd64\;^
C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\;^
C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\;^
C:\Program Files (x86)\Windows Kits\8.1\bin\x64;
goto test_bin_locations
:set_vc12_x64
@echo Setting environment for using Microsoft Visual Studio 2012 x64 tools.
set INCLUDE=^
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include;^
C:\Program Files (x86)\Windows Kits\8.1\Include\um;^
C:\Program Files (x86)\Windows Kits\8.1\Include\shared;^
C:\Program Files (x86)\Windows Kits\8.1\Include\WinRT;
set LIB=^
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\lib\amd64\;^
C:\Program Files (x86)\Windows Kits\8.1\Lib\winv6.3\um\x86\;^
C:\Program Files (x86)\Windows Kits\8.0\Lib\Win8\um\x86\;
set PATH=^
C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;^
%SystemRoot%\system32;^
%SystemRoot%;^
%SystemRoot%\System32\Wbem;^
%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;^
C:\MinGW\bin\;^
C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;^
C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.0\;^
C:\Qt\Qt5.3.1\5.3\msvc2013_64_opengl\bin\;^
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\x86_amd64\;^
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\;^
C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\;^
C:\Program Files (x86)\Windows Kits\8.1\bin\x64;
goto test_bin_locations
:test_bin_locations
@echo on
where nmake
where cl.exe
where link.exe
@echo off
goto:eof
:error
@echo Usage: setenv.bat [vc11_x86^|vc11_x64^|vc12_x64]
goto:eof
Компиляция генерирует openctm.dll, когда я использую среду vc11_x86.
Но происходит сбой при использовании среды vc11_x64 или vc12_x64.
Основная ошибка vc12_x64:
link /MACHINE:X64 /nologo /out:openctm.dll /dll /implib:openctm.lib /def
:openctm-msvc.def openctm.obj stream.obj compressRAW.obj compressMG1.obj com
pressMG2.obj Alloc.obj LzFind.obj LzmaDec.obj LzmaEnc.obj LzmaLib.obj openct
m.res
LINK : fatal error LNK1104: cannot open file 'LIBCMT.lib'
vc11_x86 основная ошибка:
Alloc.obj : error LNK2001: unresolved external symbol free
openctm.obj : error LNK2019: unresolved external symbol free referenced in funct
ion ctmFreeContext
stream.obj : error LNK2001: unresolved external symbol free
compressMG1.obj : error LNK2001: unresolved external symbol free
compressMG2.obj : error LNK2001: unresolved external symbol free
Alloc.obj : error LNK2001: unresolved external symbol malloc
openctm.obj : error LNK2019: unresolved external symbol malloc referenced in fun
ction ctmNewContext
Пожалуйста, укажите мне правильное направление, как решить эту проблему.
хорошо, я нашел проблемы:
Я установил Microsoft Visual Studio Express 2013 для Windows. Установка Microsoft Visual Studio Express 2013 для настольных ПК решала проблему vc12_x64
В файле setenv.bat была ссылка на библиотеки x86. Правильный файл:
@rem Setting environment for using Microsoft Visual Studio x86/x64 tools.
@echo off
@if "%1"=="vc11_x86" goto set_vc11_x86
@if "%1"=="vc11_x64" goto set_vc11_x64
@if "%1"=="vc12_x64" goto set_vc12_x64
@if "%1"=="" goto error
:set_vc11_x86
@echo Setting environment for using Microsoft Visual Studio 2011 x86 tools.
set INCLUDE=^
C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include;^
C:\Program Files (x86)\Windows Kits\8.1\Include\um;^
C:\Program Files (x86)\Windows Kits\8.1\Include\shared;^
C:\Program Files (x86)\Windows Kits\8.1\Include\WinRT;
set LIB=^
C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\lib\;^
C:\Program Files (x86)\Windows Kits\8.1\Lib\winv6.3\um\x86\;^
C:\Program Files (x86)\Windows Kits\8.0\Lib\Win8\um\x86\;set PATH=^
C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;^
%SystemRoot%\system32;^
%SystemRoot%;^
%SystemRoot%\System32\Wbem;^
%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;^
C:\MinGW\bin\;^
C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;^
C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.0\;^
C:\Qt\Qt5.3.1\5.3\msvc2013_64_opengl\bin\;^
C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\;^
C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\;^
C:\Program Files (x86)\Windows Kits\8.1\bin\x86\;
goto test_bin_locations
:set_vc11_x64
@echo Setting environment for using Microsoft Visual Studio 2011 x64 tools.
set INCLUDE=^
C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include;^
C:\Program Files (x86)\Windows Kits\8.1\Include\um;^
C:\Program Files (x86)\Windows Kits\8.1\Include\shared;^
C:\Program Files (x86)\Windows Kits\8.1\Include\WinRT;
set LIB=^
C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\lib\;^
C:\Program Files (x86)\Windows Kits\8.1\Lib\winv6.3\um\x64\;^
C:\Program Files (x86)\Windows Kits\8.0\Lib\Win8\um\x64\;
set PATH=^
C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;^
%SystemRoot%\system32;^
%SystemRoot%;^
%SystemRoot%\System32\Wbem;^
%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;^
C:\MinGW\bin\;^
C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;^
C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.0\;^
C:\Qt\Qt5.3.1\5.3\msvc2013_64_opengl\bin\;^
C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\x86_amd64\;^
C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\;^
C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\;^
C:\Program Files (x86)\Windows Kits\8.1\bin\x64;
goto test_bin_locations
:set_vc12_x64
@echo Setting environment for using Microsoft Visual Studio 2012 x64 tools.
set INCLUDE=^
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include;^
C:\Program Files (x86)\Windows Kits\8.1\Include\um;^
C:\Program Files (x86)\Windows Kits\8.1\Include\shared;^
C:\Program Files (x86)\Windows Kits\8.1\Include\WinRT;
set LIB=^
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\lib\amd64\;^
C:\Program Files (x86)\Windows Kits\8.1\Lib\winv6.3\um\x64\;^
C:\Program Files (x86)\Windows Kits\8.0\Lib\Win8\um\x64\;
set PATH=^
C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;^
%SystemRoot%\system32;^
%SystemRoot%;^
%SystemRoot%\System32\Wbem;^
%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;^
C:\MinGW\bin\;^
C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;^
C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.0\;^
C:\Qt\Qt5.3.1\5.3\msvc2013_64_opengl\bin\;^
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\x86_amd64\;^
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\;^
C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\;^
C:\Program Files (x86)\Windows Kits\8.1\bin\x64;^
C:\Program Files (x86)\MSBuild\12.0\Bin\amd64;
goto test_bin_locations
:test_bin_locations
@echo on
where nmake
where cl.exe
where link.exe
@echo off
goto:eof
:error
@echo Usage: setenv.bat [vc11_x86^|vc11_x64^|vc12_x64]
goto:eof