Solved

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

Posted on 2012-04-10
14
435 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
Comment Utility
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
Comment Utility
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
Comment Utility
0
 

Author Comment

by:mohet01
Comment Utility
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
Comment Utility
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
Comment Utility
Well, have you tried adding the library? Your probems should be solved then...
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Author Comment

by:mohet01
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Hello
Can somebody respond?
Sham
0
 
LVL 86

Expert Comment

by:jkr
Comment Utility
>>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
Comment Utility
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
Comment Utility
Thanx
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
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 pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.

771 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

8 Experts available now in Live!

Get 1:1 Help Now