Solved

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

Posted on 2012-04-10
14
448 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
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

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
 

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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use for-loops in the C programming language.
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use nested-loops in the C programming language.

839 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