PDA

View Full Version : About link in Visual Studio 2003



vencent
15th January 2008, 08:34
I use gecko-sdk and Qt4 in Visual Studio 2003 .

I succeed in linking my project with IDE(Visual Studio 2003), but failed window console.

the infomation is :


Microsoft Windows XP [版本 5.1.2600]
(C) 版权所有 1985-2001 Microsoft Corp.

link /LIBPATH:"c:\QT\4.3.1\lib" /NOLOGO /INCREMENTAL:NO /SUBSYSTEM:CONSO
LE /NODEFAULTLIB:libc /OUT:..\..\src\C++\bin\ObjectBuilder.exe @C:\DOCUME~1\ADMI
NI~1\LOCALS~1\Temp\nm43.tmp
xpcomglue.lib(nsGREDirServiceProvider.obj) : error LNK2019: 无法解析的外部符号 _
_imp__RegCloseKey@4 ,该符号在函数 _GRE_GetGREPath 中被引用
xpcomglue.lib(nsGREDirServiceProvider.obj) : error LNK2019: 无法解析的外部符号 _
_imp__RegQueryValueExA@24 ,该符号在函数 _GRE_GetGREPath 中被引用
xpcomglue.lib(nsGREDirServiceProvider.obj) : error LNK2019: 无法解析的外部符号 _
_imp__RegOpenKeyExA@20 ,该符号在函数 _GRE_GetGREPath 中被引用
..\..\src\C++\bin\ObjectBuilder.exe : fatal error LNK1120: 3 个无法解析的外部命

NMAKE : fatal error U1077: “link” : 返回代码“0x460”
Stop.


but i can succeed in IDE., just some warnings. as follow:

INK : warning LNK4068: 未指定 /MACHINE;默认设置为 X86
LINK : warning LNK4098: 默认库“MSVCRT”与其他库的使用冲突;使用 /NODEFAULTLIB:library
xpcomglue.lib(nsCOMPtr.obj) : warning LNK4099: 未发现 PDB“xpcomglue.pdb”有“D:\CTP-6800\code\src\C++/lib/xpcomglue.lib”或者在“d:\Ctp-6800\code\src\C++\bin\xpcomglue.pdb”中;正在链接对象 ,如同没有调试信息一样
xpcomglue.lib(nsDebug.obj) : warning LNK4099: 未发现 PDB“xpcomglue.pdb”有“D:\CTP-6800\code\src\C++/lib/xpcomglue.lib”或者在“d:\Ctp-6800\code\src\C++\bin\xpcomglue.pdb”中;正在链接对象 ,如同没有调试信息一样
xpcomglue.lib(nsMemory.obj) : warning LNK4099: 未发现 PDB“xpcomglue.pdb”有“D:\CTP-6800\code\src\C++/lib/xpcomglue.lib”或者在“d:\Ctp-6800\code\src\C++\bin\xpcomglue.pdb”中;正在链接对象 ,如同没有调试信息一样
xpcomglue.lib(nsXPCOMGlue.obj) : warning LNK4099: 未发现 PDB“xpcomglue.pdb”有“D:\CTP-6800\code\src\C++/lib/xpcomglue.lib”或者在“d:\Ctp-6800\code\src\C++\bin\xpcomglue.pdb”中;正在链接对象 ,如同没有调试信息一样
xpcomglue.lib(nsGREDirServiceProvider.obj) : warning LNK4099: 未发现 PDB“xpcomglue.pdb”有“D:\CTP-6800\code\src\C++/lib/xpcomglue.lib”或者在“d:\Ctp-6800\code\src\C++\bin\xpcomglue.pdb”中;正在链接对象 ,如同没有调试信息一样
生成日志保存在“file://d:\Ctp-6800\code\unitTest\ObjectBuilder\objs\\BuildLog.ht m”中
ObjectBuilder - 0 错误,7 警告


---------------------- 完成 ---------------------

生成: 1 已成功, 0 已失败, 0 已跳过


:confused: thanks

wysota
15th January 2008, 10:07
Do you use the same project/make file in the two environments?

vencent
15th January 2008, 11:06
Do you use the same project/make file in the two environments?

yes, i am sure

wysota
15th January 2008, 11:13
Then it is not possible to receive two different results. If that happens, you are either using different environments or build steps are different. There are no other possibilities. Check if the linker commands issued from both builds are exactly the same.

vencent
15th January 2008, 12:05
In IDE, I can't find the file 'Makefile' in the project folder.



In console, i do as follows:

(1) qmake projectName.pro

then i can find the file Makefile makefile.release makefile.debug 3 files

(2) nmake

but failed.

vencent
15th January 2008, 12:08
Then it is not possible to receive two different results. If that happens, you are either using different environments or build steps are different. There are no other possibilities. Check if the linker commands issued from both builds are exactly the same.

i don't know how to find out the difference between IDE and console

wysota
15th January 2008, 15:41
Visual Studio doesn't use the .pro file, thus the difference between the two builds. You are probably missing some file in the .pro file that contains those missing symbols. Either create a proper project file or generate a makefile from the Visual Studio project (don't ask me how, I don't know).

vencent
16th January 2008, 01:31
set QMAKESPEC = win32-msvc.net

and then modify $QTDIR/mkspecs/win32-msvc.net/qmake.conf


QMAKE_LINK* = link /NODEFAULTLIB:MSVCRT /DEFAULTLIB:ADVAPI32


enjoy!~

vencent
16th January 2008, 01:32
wysota , thanks