Home > Back-end >  C cannot resolve external symbol
C cannot resolve external symbol

Time:09-16

Topic is: there is a string, with dry characters, required to enter a character, procedure will delete from the characters from a string, use external function implementation,

The various points below program compile time all have no problem, when debugging to the following error
Bother bosses to see what's going on, first here
thank you in advance?The main obj: error LNK2001: unresolved external symbol _print_string
The main obj: error LNK2001: unresolved external symbol _enter_string
The Debug/function. Exe: fatal error LNK1120:2 unresolved externals
An error occurred when execution link. Exe.

The source code is as follows:
 
#include
Void main ()
{
Extern void enter_string (char STR []);

Extern void delete_string (char STR [], char x);

Extern void print_string (char STR []);

/* the above three is to define the statement in this function you need to call other file defines the three functions of */

char c;

Char STR [80]./* the longest string can enter 80 characters */

Enter_string (STR);

Printf (" \ please enter the characters you need to remove a: ");

The scanf (" % c ", & amp; C);

Delete_string (STR, c);

Print_string (STR);

}



A second program:

 # include & lt; stdio.h> 


Void enter_string (char STR [80])
{
Gets (STR);
}


The third block
 

Void delete_string (char STR [], char x)
{
int i,j;

For (I=j=0; STR [I]!='\ 0'; I++)
{
If (STR [I]!=x)
{STR=STR [j++] [I];
}
}
STR [j]='\ 0';
}



The fourth block:

] # include & lt; stdio.h> 

Void print_string (char STR [])
{
Printf (" % s \ n ", STR);
}

CodePudding user response:

Contains this three functions of file # include "file"

CodePudding user response:

Link all the file link in line you don't have the link all, lead to the failure symbol position
  • Related