Solved

#include "leaktracker.h" is giving fatal link error

Posted on 2012-04-10
14
441 Views
Last Modified: 2012-06-21
Hello
I am including leaktracker.h provided by
By David Maisonave (Axter)
in my c code abc project  and building in VS 2003.

But i see the following errors:

abc.obj : error LNK2019: unresolved external symbol @_leaktracker61_GenericResourceAllocatorWithVoidReturn@44 referenced in function @list_ctl_ptr@0
abc.obj : error LNK2019: unresolved external symbol @_leaktracker61_SetPointerToNullValueIfOptionSet@4 referenced in function @free_list_ctl@0
abc.obj : error LNK2019: unresolved external symbol @_leaktracker61_free@16 referenced in function @free_list_ctl@0
abc.obj : error LNK2019: unresolved external symbol @_leaktracker61_realloc@20 referenced in function @getBasicCubeMatchList@36
..\Sdks\CaPmPcm\bin\abc.dll : fatal error LNK1120: 4 unresolved externals


How do i resolve it?

Sham
leaktracker.h
0
Comment
Question by:mohet01
  • 7
  • 5
14 Comments
 
LVL 86

Accepted Solution

by:
jkr earned 500 total points
ID: 37828368
You'll need to link with "leaktracker.lib" (included in http://code.axter.com/leaktracker.zip) to resolve these errors - either add that to your project or use

#pragma comment(lib,"leaktracker.lib")

in your code.
0
 
LVL 86

Expert Comment

by:jkr
ID: 37828591
Oh, I forgot - since someone for sure might think the issue about "how to add a library to your project" was not covered enough, see also http://social.msdn.microsoft.com/Forums/en-US/vcgeneral/thread/b1c1f13d-f830-4831-8cea-065dcc14de16 ("Adding C library to Visual c++ project", also applies to C++ libraries). In a nutshell:

Next we need to add .lib file to the Additional Dependencies (Project property pages -> Configuration Properties -> Linker -> Input).
0
 
LVL 86

Expert Comment

by:jkr
ID: 37828640
0
 

Author Comment

by:mohet01
ID: 37830748
hello jkr
I did not find problem in building other projects after just including leaktracker.h file
Why this project has the problem?
And david author also not recommend to point to .lib in the project but to place in system32 on running app machine

Sham
0
 

Author Comment

by:mohet01
ID: 37830799
hello jkr
One of the problem line, where this problem occurred is
(*ptr) = (ptr1) malloc (sizeof(**ptr1))
Sham
0
 
LVL 86

Expert Comment

by:jkr
ID: 37830803
Well, have you tried adding the library? Your probems should be solved then...
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:mohet01
ID: 37831561
Hello jkr
I did not find problem in building other projects after just including leaktracker.h file
Why this project has the problem?
And david author also not recommend to point to .lib in the project but to just place in system32 folder on running app machine

Sham
0
 

Author Comment

by:mohet01
ID: 37831578
hello jkr
i already added this library yesterday, as per attached screen shot.
But it did not work
Sham
scn.png
0
 

Author Comment

by:mohet01
ID: 37831796
Hello
Please read my previous update.

If we see one error in function list_ctl_ptr(), malloc is called like this:
if (*ctl_ptr_ptr == NULL) {
              if ((*ctl_ptr_ptr = (LIST_INFO_PTR)
                        malloc ( sizeof (**ctl_ptr_ptr ) )) == NULL) {
                     C_RETURN (NULL) ;
              }

Do you think, the way malloc() is caled is the problem?

Sham
0
 

Author Comment

by:mohet01
ID: 37832896
Hello
Can somebody respond?
Sham
0
 
LVL 86

Expert Comment

by:jkr
ID: 37834445
>>One of the problem line, where this problem occurred is
>>(*ptr) = (ptr1) malloc (sizeof(**ptr1))

Err, in your original Q, you were talking about linker errors - what is the problem with the above line?
0
 
LVL 30

Expert Comment

by:Axter
ID: 37846299
Hi mohet01,

I'm the original author of that library.

Are you still having issues with this library, or did jkr give you what you needed to get it working?
0
 

Author Closing Comment

by:mohet01
ID: 38109452
Thanx
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The goal of this video is to provide viewers with basic examples to understand opening and reading files in the C programming language.
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

896 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now