Software Archive
Read-only legacy content
17061 Discussions

linker errors

katoba88
Beginner
246 Views
I'm trying to link a VF app with Tcl: when I link the following code with my application I get the subsequent link error. The required static libraries have been included in the settings, and I don't think name decoration is the problem. Any ideas. (the Tcl .libs also require dlls at runtime - calling problem here?)

Thanks


/* 
 tclint.c, a simple Tcl interpreter. 
*/ 
 
#include  
#include  
#include  
     
 
Tcl_Interp* interp; 
 
int TclEvalFile() 
 
{  
	int         status; 
	char* string; 
	string = "hello.tcl"; 
        status = TCL_OK; 
        status = Tcl_EvalFile(interp, string); 
 
        /* Print result string. */ 
        if (interp->result != NULL) { 
 
            printf("TCL: [%s]
", interp->result); 
        } 
  return status; 
} 
 
int TclCreateInterp() 
 
{  
 
    interp = Tcl_CreateInterp(); 
    return 0; 
} 
 
int TclDeleteInterp() 
 
{ 
 
   /* Free memory for interpreter. */ 
    Tcl_DeleteInterp(interp); 
    return 0; 
} 
 
LINK : warning LNK4098: defaultlib "LIBCD" conflicts with use of other libs; use /NODEFAULTLIB:library 
saratcl.obj : error LNK2001: unresolved external symbol __imp__Tcl_EvalFile@8 
saratcl.obj : error LNK2001: unresolved external symbol __imp__Tcl_CreateInterp@0 
saratcl.obj : error LNK2001: unresolved external symbol __imp__Tcl_DeleteInterp@4 
../sara3d.exe : fatal error LNK1120: 3 unresolved externals 
Error executing link.exe. 
 
sara3d.exe - 4 error(s), 1 warning(s)
0 Kudos
3 Replies
Steven_L_Intel1
Employee
246 Views
First, it would appear you are building a debug configuration. Please go to Project..Settings..Fortran..Libraries and check the box that says "Use debug C libraries".

Next, the unresolved references appear to be caused by your not including the TCL DLL's import library in your list of libraries to be searched - or just add it to the project.

Steve
0 Kudos
katoba88
Beginner
246 Views
Steve: I did as suggested and got same error. If I include the ells explicitly in the link,libs settings I get:

Linking...
Start Pass1
libs cl80.dll : fatal error LNK1136: invalid or corrupt file
Error executing link.exe.

sara3d.exe - 1 error(I), 0 warning(I)

If I just include the ells in the project I still get:

Searching .libs k80.lib:
Searching .libssend_file. lib:
Searching .libs cl80.lib:
Searching .libssee32.lib:
Done Searching Libraries
LINK : warning LNK4098: default lib "libc.lib" conflicts with use of other libs; use /NODEFAULTLIB:library
End Pass1
xpression.obj : error LNK2001: unresolved external symbol __imp__Tcl_EvalFile@8
xpression.obj : error LNK2001: unresolved external symbol __imp__Tcl_CreateInterp@0
xpression.obj : error LNK2001: unresolved external symbol __imp__Tcl_DeleteInterp@4
DEBUG/sara3d.exe : fatal error LNK1120: 3 unresolved externals
Error executing link.exe.

(Note the tcl/tk libs are being searched for unresolved names but not dlls)

I have used the same tcl/tk libs & dlls in a small C program with same code and it works fine. (BTW: I don't include the dlls in the project; just make sure there are available at execution time). I also used dumpbin to look at the tcl dlls and can find missing names.

Any help would be appreciated - I'm probably missing a setting someplace.

Thanks

Denny Moore
0 Kudos
Steven_L_Intel1
Employee
246 Views
If by "ells" you mean the .DLL files, you don't "link against DLLs" and don't put DLLs in the project or link libs options. When a DLL is created, the MS linker also creates a .LIB file called an "export library". THIS is what you need to link against.

If you don't have one, then use the MAKILIB tool to create one from the DLL.

I still think you have a problem with a mixture of debug and non-debug C libraries.

Steve
0 Kudos
Reply