Home > Back-end >  The unresolved external symbol
The unresolved external symbol

Time:12-03

H statement
in hrec.Void myprint (void)
C
in hrec.Void myprint (void)
{
Printf (" ab \ n "); }
C
in hvi.# include "hrec. H"
In the function call
Myprint ();

Run error
The unresolved external symbol _myprint
Other function can invoke the hrec. C, other function is already some, myprint is my own, why not?

CodePudding user response:

//h file
 
# include "stdio.h"
Void teset (void);

//c file
 
# include "text. H"
Void teset (void)
{
Printf (" AA ");
}


//main program
 
# include "stdio.h"
# include "text. H"

Int main ()
{
While (1)
{
Teset ();
}
}



The test is no problem.

CodePudding user response:

I tried to build a project is no problem, I think as long as find a function declaration, engineering will be in the whole project within your own definition, don't know why here is no good, but the hrec. C can call other functions, this program is old, I read and compiled using nmake, head

CodePudding user response:

I tried to build a project is no problem, I think as long as find a function declaration, engineering will be in the whole project within your own definition, don't know why here is no good, but the hrec. C can call other functions, this program is old, I read and compiled using nmake, head

CodePudding user response:

Make compilation includes implementation file

CodePudding user response:

Understanding of the compile and link is a problem, if not taught in the school these things?
Reference identification function header file just help compiler "like" and produce the target file, this stage is to decide how to call a function, do not need to know the actual location of the function and content,
But the linking phase, the linker needs to find the definition of function,
Think of it, these two steps, where one step,

CodePudding user response:

You can use other functions of hrec that there should be no problem if you modify the file does not compile to you or delete files to compile error after recompile again so make sure that the compiler to identify your modifications

CodePudding user response:

I'm a little dizzy, I later tried the simple function is no problem, because there is a parameter in a function at the beginning, I can only type to write statement. I remember don't write the parameter name, compile time encounter problems, check the don't know what the problem several times, was later found to be statement didn't write a parameter name, may I use the compiler version too old, too old standard in all I remember now most can only write when the statement type, may be early standard must be declared and defined the same, thank you, were transferred to sometimes can't imagine to be the problem

CodePudding user response:

I'm a little dizzy, I later tried the simple function is no problem, because there is a parameter in a function at the beginning, I can only type to write statement. I remember don't write the parameter name, compile time encounter problems, check the don't know what the problem several times, was later found to be statement didn't write a parameter name, may I use the compiler version too old, too old standard in all I remember now most can only write when the statement type, may be early standard must be declared and defined the same, thank you, were transferred to sometimes can't imagine to be the problem
  • Related