Solved

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

Posted on 2012-04-10
14
450 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

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…
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 recursion in the C programming language.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

751 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