为什么我的一个CPP文件在使用命令行编译时没有被构建
设置: 视窗XP 微软VisualStudio 2003 Sybase SQL Anywhere 9 嵌入式 SQL(我知道......但这是一个非常古老的项目)
这个项目的设置就像我在这里遇到的许多其他项目一样。 SQL预编译器处理SQC文件以生成CPP文件,然后将其编译成OBJ,最后链接到DLL的一部分。
使用GUI开发环境时没有问题。该解决方案每次在每台机器上都能成功构建。
从命令行构建时,结果似乎取决于机器/环境。事实上,最初我能够在命令行上成功编译该项目。现在,我也遇到了问题。
我已经四次检查了路径。以及设置。它看起来就像任何其他具有此类设置的项目一样。路径有效。我拥有整个系统的管理员权限。生成的文件不是只读的,也不是签入 RCS 的。当我清理时,文件将被删除,包括 CPP。 CPP 不被排除在项目的构建之外。
根据我的发现,生成的 CPP 文件已创建并位于应有的位置,但未添加到编译器响应文件中。因此,CPP 从未建成。但链接器响应文件的列表中包含 OBJ。由于该文件因未编译而不存在,因此无法链接。
对于还有什么可能导致此问题,我已经没有想法了。
该命令:
"C:\Program Files\Microsoft Visual Studio .NET 2003\Common7\Tools\..\ide\devenv.com" C:\workspaces\Borg\Main\_build\..\BioID\BioID.sln /build Release /out C:\workspaces\Borg\Main\_build\..\_build\output\visualstudio.log
产生以下 BuildLog.htm。这些路径与我们使用 nant 的构建脚本定义的完全相同,因此我可以直接随意重新创建问题。
------- Build started: Project: PyxPosId, Configuration: Release|Win32 -------
Command Lines Creating temporary file "c:\workspaces\Borg\Main\BioID\Release\BAT000001.bat" with contents
[
@echo off
sqlpp -o WINNT -r "c:\workspaces\Borg\Main\BioID\SQLBIO.SQC" "c:\workspaces\Borg\Main\BioID\SQLBIO".cpp
if errorlevel 1 goto VCReportError
goto VCEnd
:VCReportError
echo Project : error PRJ0019: A tool returned an error code from "Performing Custom Build Step"
exit 1
:VCEnd
]
Creating command line "c:\workspaces\Borg\Main\BioID\Release\BAT000001.bat"
Creating temporary file "c:\workspaces\Borg\Main\BioID\Release\RSP000002.rsp" with contents
[
/O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "_WINDLL" /FD /EHsc /MT /YX"stdafx.h" /Fp".\PyxPosId___Win32_Release_Sybase9/BioId.pch" /Fo".\PyxPosId___Win32_Release_Sybase9/" /Fd".\PyxPosId___Win32_Release_Sybase9/" /W3 /c /TP
.\VXBio.cpp
.\VFSbio.cpp
.\VBioDlg.cpp
.\USTDREG.CPP
.\USTDNEW.CPP
.\STDREG.CPP
.\STDNEW.CPP
.\SetupConfigPage.cpp
.\SCCfgDlg.cpp
.\ScanId.cpp
.\pyxsheet.cpp
.\PyxPosId.cpp
.\MsgBox.cpp
.\FTbio.cpp
.\FIUBIO.CPP
.\DevTypePg.cpp
.\CGray8Dib.cpp
.\CardScan.cpp
.\bioutils.cpp
.\BioSet.cpp
.\BioDb.cpp
.\BIO.CPP
.\APPSRC.CPP
]
Creating command line "cl.exe @c:\workspaces\Borg\Main\BioID\Release\RSP000002.rsp /nologo"
Creating temporary file "c:\workspaces\Borg\Main\BioID\Release\RSP000003.rsp" with contents
[
/O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "_WINDLL" /FD /EHsc /MT /Yc"stdafx.h" /Fp".\PyxPosId___Win32_Release_Sybase9/BioId.pch" /Fo".\PyxPosId___Win32_Release_Sybase9/" /Fd".\PyxPosId___Win32_Release_Sybase9/" /W3 /c /TP
.\StdAfx.cpp
]
Creating command line "cl.exe @c:\workspaces\Borg\Main\BioID\Release\RSP000003.rsp /nologo"
Creating command line "rc.exe /d "NDEBUG" /l 0x409 /fo"Release/BIO.res" .\BIO.RC"
Creating temporary file "c:\workspaces\Borg\Main\BioID\Release\RSP000004.rsp" with contents
[
/OUT:"PyxPosId___Win32_Release_Sybase9/Pyxposid.dll" /INCREMENTAL:NO /NOLOGO /DLL /NODEFAULTLIB:"libc.lib" /NODEFAULTLIB:"LIBCMTD" /DEF:".\PyxPosId.def" /DELAYLOAD:"OleAcc.dll" /PDB:".\PyxPosId___Win32_Release_Sybase9/Pyxposid.pdb" /SUBSYSTEM:WINDOWS /IMPLIB:".\PyxPosId___Win32_Release_Sybase9/Pyxposid.lib" /MACHINE:X86 NAFXCW.LIB dblibtm.lib dpfpfns.lib dpmatch.lib vxapi.lib DelayImp.lib DelayImp.lib
.\pyxposid___win32_release_sybase9\APPSRC.obj
.\pyxposid___win32_release_sybase9\BIO.obj
.\Release\BIO.res
.\pyxposid___win32_release_sybase9\BioDb.obj
.\pyxposid___win32_release_sybase9\BioSet.obj
.\pyxposid___win32_release_sybase9\bioutils.obj
.\pyxposid___win32_release_sybase9\CardScan.obj
.\pyxposid___win32_release_sybase9\CGray8Dib.obj
.\pyxposid___win32_release_sybase9\DevTypePg.obj
.\pyxposid___win32_release_sybase9\FIUBIO.obj
.\pyxposid___win32_release_sybase9\FTbio.obj
.\pyxposid___win32_release_sybase9\MsgBox.obj
.\pyxposid___win32_release_sybase9\PyxPosId.obj
.\pyxposid___win32_release_sybase9\pyxsheet.obj
.\pyxposid___win32_release_sybase9\ScanId.obj
.\pyxposid___win32_release_sybase9\SCCfgDlg.obj
.\pyxposid___win32_release_sybase9\SetupConfigPage.obj
.\pyxposid___win32_release_sybase9\Sqlbio.obj
.\pyxposid___win32_release_sybase9\StdAfx.obj
.\pyxposid___win32_release_sybase9\STDNEW.obj
.\pyxposid___win32_release_sybase9\STDREG.obj
.\pyxposid___win32_release_sybase9\USTDNEW.obj
.\pyxposid___win32_release_sybase9\USTDREG.obj
.\pyxposid___win32_release_sybase9\VBioDlg.obj
.\pyxposid___win32_release_sybase9\VFSbio.obj
.\pyxposid___win32_release_sybase9\VXBio.obj
]
Creating command line "link.exe @c:\workspaces\Borg\Main\BioID\Release\RSP000004.rsp"
Output Window Performing Custom Build Step
Adaptive Server Anywhere Embedded SQL Version 9.0.2.3169
Using collation sequence "1252LATIN1"
c:/workspaces/Borg/Main/BioID/SQLBIO.SQC(715): Warning! W2665 near ';': host variable 'hvuserIid' has been redefined
Compiling...
StdAfx.cpp
WINVER not defined. Defaulting to 0x0501 (Windows XP and Windows .NET Server)
Compiling...
VXBio.cpp
WINVER not defined. Defaulting to 0x0501 (Windows XP and Windows .NET Server)
VXBio.cpp(818) : warning C4244: '=' : conversion from '__time64_t' to 'time_t', possible loss of data
VFSbio.cpp
**OPTION** WIN32=Building for 32-bit Windows
VBioDlg.cpp
WINVER not defined. Defaulting to 0x0501 (Windows XP and Windows .NET Server)
**OPTION** WIN32=Building for 32-bit Windows
USTDREG.CPP
WINVER not defined. Defaulting to 0x0501 (Windows XP and Windows .NET Server)
**OPTION** WIN32=Building for 32-bit Windows
USTDNEW.CPP
**OPTION** WIN32=Building for 32-bit Windows
STDREG.CPP
WINVER not defined. Defaulting to 0x0501 (Windows XP and Windows .NET Server)
**OPTION** WIN32=Building for 32-bit Windows
STDNEW.CPP
**OPTION** WIN32=Building for 32-bit Windows
SetupConfigPage.cpp
WINVER not defined. Defaulting to 0x0501 (Windows XP and Windows .NET Server)
**OPTION** WIN32=Building for 32-bit Windows
SCCfgDlg.cpp
WINVER not defined. Defaulting to 0x0501 (Windows XP and Windows .NET Server)
ScanId.cpp
pyxsheet.cpp
PyxPosId.cpp
MsgBox.cpp
FTbio.cpp
FIUBIO.CPP
WINVER not defined. Defaulting to 0x0501 (Windows XP and Windows .NET Server)
FIUBIO.CPP(1456) : warning C4244: '=' : conversion from '__time64_t' to 'time_t', possible loss of data
DevTypePg.cpp
WINVER not defined. Defaulting to 0x0501 (Windows XP and Windows .NET Server)
CGray8Dib.cpp
CardScan.cpp
WINVER not defined. Defaulting to 0x0501 (Windows XP and Windows .NET Server)
bioutils.cpp
WINVER not defined. Defaulting to 0x0501 (Windows XP and Windows .NET Server)
BioSet.cpp
WINVER not defined. Defaulting to 0x0501 (Windows XP and Windows .NET Server)
BioDb.cpp
BioDb.cpp(508) : warning C4244: '=' : conversion from '__time64_t' to 'time_t', possible loss of data
BIO.CPP
WINVER not defined. Defaulting to 0x0501 (Windows XP and Windows .NET Server)
**OPTION** WIN32=Building for 32-bit Windows
BIO.CPP(1202) : warning C4244: '=' : conversion from '__time64_t' to 'time_t', possible loss of data
BIO.CPP(1319) : warning C4244: '=' : conversion from '__time64_t' to 'time_t', possible loss of data
APPSRC.CPP
WINVER not defined. Defaulting to 0x0501 (Windows XP and Windows .NET Server)
Compiling resources...
Linking...
LINK : fatal error LNK1181: cannot open input file '.\pyxposid___win32_release_sybase9\Sqlbio.obj'
Results Build log was saved at "file://c:\workspaces\Borg\Main\BioID\Release\BuildLog.htm"
PyxPosId - 1 error(s), 5 warning(s)
The setup:
Windows XP
MS VisualStudio 2003
Sybase SQL Anywhere 9
Embedded SQL (I know...but it's a really old project)
This project is setup like so many others I have encountered here. The SQL precompiler processes a SQC file to generate a CPP file which is then compiled into an OBJ and finally linked into part of the DLL.
When using the GUI dev environment, there is no problem. The solution builds successfully every time, every machine.
When building from the command-line, the results seem to depend on the machine/environment. In fact, I was able to successfully compile the project on the command-line successfully, initially. Now, I too am having issues.
I have quadruple checked the paths. And the settings. It looks just like any other project with this type of setup. The paths are valid. I have admin rights to the entire system. The generated file is not read-only or checked-in to the RCS. When I clean, the files are removed including the CPP. The CPP is not excluded from the build in the project.
From what I have found, the generated CPP file is created and located where it should be but doesn't get added to the compiler response file. So the CPP is never built. But the linker response file contains the OBJ in its listing. Since the file does not exist because it was not compiled, it fails to link.
I've run out of ideas on what else could cause this issue.
The command:
"C:\Program Files\Microsoft Visual Studio .NET 2003\Common7\Tools\..\ide\devenv.com" C:\workspaces\Borg\Main\_build\..\BioID\BioID.sln /build Release /out C:\workspaces\Borg\Main\_build\..\_build\output\visualstudio.log
results in the following BuildLog.htm. The paths are exactly as defined by our build script using nant so I can recreate the problem at will directly.
------- Build started: Project: PyxPosId, Configuration: Release|Win32 -------
Command Lines Creating temporary file "c:\workspaces\Borg\Main\BioID\Release\BAT000001.bat" with contents
[
@echo off
sqlpp -o WINNT -r "c:\workspaces\Borg\Main\BioID\SQLBIO.SQC" "c:\workspaces\Borg\Main\BioID\SQLBIO".cpp
if errorlevel 1 goto VCReportError
goto VCEnd
:VCReportError
echo Project : error PRJ0019: A tool returned an error code from "Performing Custom Build Step"
exit 1
:VCEnd
]
Creating command line "c:\workspaces\Borg\Main\BioID\Release\BAT000001.bat"
Creating temporary file "c:\workspaces\Borg\Main\BioID\Release\RSP000002.rsp" with contents
[
/O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "_WINDLL" /FD /EHsc /MT /YX"stdafx.h" /Fp".\PyxPosId___Win32_Release_Sybase9/BioId.pch" /Fo".\PyxPosId___Win32_Release_Sybase9/" /Fd".\PyxPosId___Win32_Release_Sybase9/" /W3 /c /TP
.\VXBio.cpp
.\VFSbio.cpp
.\VBioDlg.cpp
.\USTDREG.CPP
.\USTDNEW.CPP
.\STDREG.CPP
.\STDNEW.CPP
.\SetupConfigPage.cpp
.\SCCfgDlg.cpp
.\ScanId.cpp
.\pyxsheet.cpp
.\PyxPosId.cpp
.\MsgBox.cpp
.\FTbio.cpp
.\FIUBIO.CPP
.\DevTypePg.cpp
.\CGray8Dib.cpp
.\CardScan.cpp
.\bioutils.cpp
.\BioSet.cpp
.\BioDb.cpp
.\BIO.CPP
.\APPSRC.CPP
]
Creating command line "cl.exe @c:\workspaces\Borg\Main\BioID\Release\RSP000002.rsp /nologo"
Creating temporary file "c:\workspaces\Borg\Main\BioID\Release\RSP000003.rsp" with contents
[
/O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "_WINDLL" /FD /EHsc /MT /Yc"stdafx.h" /Fp".\PyxPosId___Win32_Release_Sybase9/BioId.pch" /Fo".\PyxPosId___Win32_Release_Sybase9/" /Fd".\PyxPosId___Win32_Release_Sybase9/" /W3 /c /TP
.\StdAfx.cpp
]
Creating command line "cl.exe @c:\workspaces\Borg\Main\BioID\Release\RSP000003.rsp /nologo"
Creating command line "rc.exe /d "NDEBUG" /l 0x409 /fo"Release/BIO.res" .\BIO.RC"
Creating temporary file "c:\workspaces\Borg\Main\BioID\Release\RSP000004.rsp" with contents
[
/OUT:"PyxPosId___Win32_Release_Sybase9/Pyxposid.dll" /INCREMENTAL:NO /NOLOGO /DLL /NODEFAULTLIB:"libc.lib" /NODEFAULTLIB:"LIBCMTD" /DEF:".\PyxPosId.def" /DELAYLOAD:"OleAcc.dll" /PDB:".\PyxPosId___Win32_Release_Sybase9/Pyxposid.pdb" /SUBSYSTEM:WINDOWS /IMPLIB:".\PyxPosId___Win32_Release_Sybase9/Pyxposid.lib" /MACHINE:X86 NAFXCW.LIB dblibtm.lib dpfpfns.lib dpmatch.lib vxapi.lib DelayImp.lib DelayImp.lib
.\pyxposid___win32_release_sybase9\APPSRC.obj
.\pyxposid___win32_release_sybase9\BIO.obj
.\Release\BIO.res
.\pyxposid___win32_release_sybase9\BioDb.obj
.\pyxposid___win32_release_sybase9\BioSet.obj
.\pyxposid___win32_release_sybase9\bioutils.obj
.\pyxposid___win32_release_sybase9\CardScan.obj
.\pyxposid___win32_release_sybase9\CGray8Dib.obj
.\pyxposid___win32_release_sybase9\DevTypePg.obj
.\pyxposid___win32_release_sybase9\FIUBIO.obj
.\pyxposid___win32_release_sybase9\FTbio.obj
.\pyxposid___win32_release_sybase9\MsgBox.obj
.\pyxposid___win32_release_sybase9\PyxPosId.obj
.\pyxposid___win32_release_sybase9\pyxsheet.obj
.\pyxposid___win32_release_sybase9\ScanId.obj
.\pyxposid___win32_release_sybase9\SCCfgDlg.obj
.\pyxposid___win32_release_sybase9\SetupConfigPage.obj
.\pyxposid___win32_release_sybase9\Sqlbio.obj
.\pyxposid___win32_release_sybase9\StdAfx.obj
.\pyxposid___win32_release_sybase9\STDNEW.obj
.\pyxposid___win32_release_sybase9\STDREG.obj
.\pyxposid___win32_release_sybase9\USTDNEW.obj
.\pyxposid___win32_release_sybase9\USTDREG.obj
.\pyxposid___win32_release_sybase9\VBioDlg.obj
.\pyxposid___win32_release_sybase9\VFSbio.obj
.\pyxposid___win32_release_sybase9\VXBio.obj
]
Creating command line "link.exe @c:\workspaces\Borg\Main\BioID\Release\RSP000004.rsp"
Output Window Performing Custom Build Step
Adaptive Server Anywhere Embedded SQL Version 9.0.2.3169
Using collation sequence "1252LATIN1"
c:/workspaces/Borg/Main/BioID/SQLBIO.SQC(715): Warning! W2665 near ';': host variable 'hvuserIid' has been redefined
Compiling...
StdAfx.cpp
WINVER not defined. Defaulting to 0x0501 (Windows XP and Windows .NET Server)
Compiling...
VXBio.cpp
WINVER not defined. Defaulting to 0x0501 (Windows XP and Windows .NET Server)
VXBio.cpp(818) : warning C4244: '=' : conversion from '__time64_t' to 'time_t', possible loss of data
VFSbio.cpp
**OPTION** WIN32=Building for 32-bit Windows
VBioDlg.cpp
WINVER not defined. Defaulting to 0x0501 (Windows XP and Windows .NET Server)
**OPTION** WIN32=Building for 32-bit Windows
USTDREG.CPP
WINVER not defined. Defaulting to 0x0501 (Windows XP and Windows .NET Server)
**OPTION** WIN32=Building for 32-bit Windows
USTDNEW.CPP
**OPTION** WIN32=Building for 32-bit Windows
STDREG.CPP
WINVER not defined. Defaulting to 0x0501 (Windows XP and Windows .NET Server)
**OPTION** WIN32=Building for 32-bit Windows
STDNEW.CPP
**OPTION** WIN32=Building for 32-bit Windows
SetupConfigPage.cpp
WINVER not defined. Defaulting to 0x0501 (Windows XP and Windows .NET Server)
**OPTION** WIN32=Building for 32-bit Windows
SCCfgDlg.cpp
WINVER not defined. Defaulting to 0x0501 (Windows XP and Windows .NET Server)
ScanId.cpp
pyxsheet.cpp
PyxPosId.cpp
MsgBox.cpp
FTbio.cpp
FIUBIO.CPP
WINVER not defined. Defaulting to 0x0501 (Windows XP and Windows .NET Server)
FIUBIO.CPP(1456) : warning C4244: '=' : conversion from '__time64_t' to 'time_t', possible loss of data
DevTypePg.cpp
WINVER not defined. Defaulting to 0x0501 (Windows XP and Windows .NET Server)
CGray8Dib.cpp
CardScan.cpp
WINVER not defined. Defaulting to 0x0501 (Windows XP and Windows .NET Server)
bioutils.cpp
WINVER not defined. Defaulting to 0x0501 (Windows XP and Windows .NET Server)
BioSet.cpp
WINVER not defined. Defaulting to 0x0501 (Windows XP and Windows .NET Server)
BioDb.cpp
BioDb.cpp(508) : warning C4244: '=' : conversion from '__time64_t' to 'time_t', possible loss of data
BIO.CPP
WINVER not defined. Defaulting to 0x0501 (Windows XP and Windows .NET Server)
**OPTION** WIN32=Building for 32-bit Windows
BIO.CPP(1202) : warning C4244: '=' : conversion from '__time64_t' to 'time_t', possible loss of data
BIO.CPP(1319) : warning C4244: '=' : conversion from '__time64_t' to 'time_t', possible loss of data
APPSRC.CPP
WINVER not defined. Defaulting to 0x0501 (Windows XP and Windows .NET Server)
Compiling resources...
Linking...
LINK : fatal error LNK1181: cannot open input file '.\pyxposid___win32_release_sybase9\Sqlbio.obj'
Results Build log was saved at "file://c:\workspaces\Borg\Main\BioID\Release\BuildLog.htm"
PyxPosId - 1 error(s), 5 warning(s)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
显然,存在区分大小写的问题。我停止使用
$(InputName)
并将名称硬编码到我的 vcproj 中以匹配所有位置。想让大家知道的是,我不会为 8 年历史的开发环境向 MS 开具故障单。
Apparently, there is a case sensitivity issue. I stopped using
$(InputName)
and hard-coded the name in my vcproj to match everwhere.Just so you are all aware, I'm not going to open a trouble ticket with MS for a 8 year old development environment.