Solved

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

Posted on 2012-04-10
14
444 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
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 

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

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

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

This tutorial is posted by Aaron Wojnowski, administrator at SDKExpert.net.  To view more iPhone tutorials, visit www.sdkexpert.net. This is a very simple tutorial on finding the user's current location easily. In this tutorial, you will learn ho…
Summary: This tutorial covers some basics of pointer, pointer arithmetic and function pointer. What is a pointer: A pointer is a variable which holds an address. This address might be address of another variable/address of devices/address of fu…
The goal of this video is to provide viewers with basic examples to understand and use switch statements 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.

810 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