Thread: Why vc++ link can not find function which is built in the same project?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Oct 2005
    Posts
    42

    Why vc++ link can not find function which is built in the same project?

    Hi there,

    When I try to build the executable, the error is as the following:

    iis.obj : error LNK2001: unresolved external symbol "int __cdecl lm(int,char *)" (?lm@@YAHHPAD@Z)
    Debug/iis.exe : fatal error LNK1120: 1 unresolved externals
    Error executing link.exe.

    The function is defined in the file buildd.c
    Code:
    //buildd.c
    #include <stdio.h>
    #include "buildd.h"
    
    int __cdecl lm(int i,char * filename)
    {
    	return i + strlen(filename);
    }
    
    file buildd.h
    
    #include "StdAfx.h"
    
    int __cdecl lm(int i,char * filename);
    and in iis.cpp, the code invoking the function lm is located in the body of int APIENTRY WinMain, which is:

    inm = lm(10,ryDict);

    Why the vc++ link can not find the function lm, which is built in the same project?

    Thanks,
    Last edited by wow; 12-29-2005 at 07:42 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. In over my head
    By Shelnutt2 in forum C Programming
    Replies: 1
    Last Post: 07-08-2008, 06:54 PM
  2. Problem Displaying a Struct
    By rockstarpirate in forum C++ Programming
    Replies: 16
    Last Post: 05-05-2008, 09:05 AM
  3. Calling a Thread with a Function Pointer.
    By ScrollMaster in forum Windows Programming
    Replies: 6
    Last Post: 06-10-2006, 08:56 AM
  4. wxWidgets link problem
    By cboard_member in forum C++ Programming
    Replies: 2
    Last Post: 02-11-2006, 02:36 PM
  5. Including lib in a lib
    By bibiteinfo in forum C++ Programming
    Replies: 0
    Last Post: 02-07-2006, 02:28 PM