Link error using GetFileVersionInfoSize() (LNK2001) 
Author Message
 Link error using GetFileVersionInfoSize() (LNK2001)

I am attempting to retrieve the version number of the EXE file for use in my
AboutBox. Using the code below I retrieve the file name and pass parameters
to the GetFileVersionInfoSize function (more code to come). It all seems
fine but I'm getting a linker error when I build. Can anyone shed any light
on the problem or offer an alternative method?

Thanks in advance,

Steve

 char szFullPath[_MAX_PATH+1];
 GetModuleFileName(AfxGetInstanceHandle(),szFullPath, _MAX_PATH+1);
 DWORD dwDummy;
 DWORD dwFVISize;
 dwFVISize = GetFileVersionInfoSize(szFullPath, &dwDummy);

Linking...
AboutDlg.obj : error LNK2001: unresolved external symbol

Debug/Configurator.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.



Mon, 25 Feb 2002 03:00:00 GMT  
 Link error using GetFileVersionInfoSize() (LNK2001)


Quote:
> I am attempting to retrieve the version number of the EXE file for use in
my
> AboutBox. Using the code below I retrieve the file name and pass
parameters
> to the GetFileVersionInfoSize function (more code to come). It all seems
> fine but I'm getting a linker error when I build. Can anyone shed any
light
> on the problem or offer an alternative method?

Try adding "version.lib" in your list of libraries. The MSDN help says that
it's required.

--
Dave Robinson,
Malvern, UK



Mon, 25 Feb 2002 03:00:00 GMT  
 Link error using GetFileVersionInfoSize() (LNK2001)
Have you remebered to link with VERSION.LIB Steve?

Regards

Derek

Quote:

> I am attempting to retrieve the version number of the EXE file for use in my
> AboutBox. Using the code below I retrieve the file name and pass parameters
> to the GetFileVersionInfoSize function (more code to come). It all seems
> fine but I'm getting a linker error when I build. Can anyone shed any light
> on the problem or offer an alternative method?

> Thanks in advance,

> Steve

>  char szFullPath[_MAX_PATH+1];
>  GetModuleFileName(AfxGetInstanceHandle(),szFullPath, _MAX_PATH+1);
>  DWORD dwDummy;
>  DWORD dwFVISize;
>  dwFVISize = GetFileVersionInfoSize(szFullPath, &dwDummy);

> Linking...
> AboutDlg.obj : error LNK2001: unresolved external symbol

> Debug/Configurator.exe : fatal error LNK1120: 1 unresolved externals
> Error executing link.exe.



Mon, 25 Feb 2002 03:00:00 GMT  
 Link error using GetFileVersionInfoSize() (LNK2001)

Quote:

>I am attempting to retrieve the version number of the EXE file for use in my
>AboutBox. Using the code below I retrieve the file name and pass parameters
>to the GetFileVersionInfoSize function (more code to come). It all seems
>fine but I'm getting a linker error when I build. Can anyone shed any light
>on the problem or offer an alternative method?

You need to link against version.lib.

Go to Project ~ Settings / Link Tab - add it to the list in the
Object/Library Modules edit box.

Should you need it, there's sample code for doing this kind of thing
on my web site. URL in my sig below. Can't remember the tip number
offhand, but its one of the early ones.

Bob Moore [MVP]
http://www.mooremvp.freeserve.co.uk
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Due to an unreasonable amount of queries, I no
longer answer unsolicited email questions. Sorry,
no exceptions, and yes, this DOES mean you.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



Mon, 25 Feb 2002 03:00:00 GMT  
 Link error using GetFileVersionInfoSize() (LNK2001)

Quote:
>AboutDlg.obj : error LNK2001: unresolved external symbol


Steve,

Add version.lib to the list of library files on the Project Settings
Link tab.

Dave
--
My address is altered to discourage junk mail.
Please post responses to the newsgroup thread,
there's no need for follow-up email copies.



Mon, 25 Feb 2002 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. GetFileVersionInfoSize error in linking

2. Link error LNK2001 while using CView derivative in a DLL

3. Linking error LNK2001 when using template classes

4. Error during linking - error LNK2001

5. Linking Error LNK2001

6. LNK2001 Linking Error

7. Linking Problem when trying to create ReleaseUMinDependency[error LNK2001: unresolved external symbol _main]

8. Link Error LNK2001: Multithreaded ATL Object

9. Link error LNK2001

10. linking error LNK2001 on DllGetClassObject

11. "error LNK2001" when linking

12. LNK2001 link errors

 

 
Powered by phpBB® Forum Software