Friday, February 19, 2010

L i n k e r E r r o r s

----------------------------------------------------------------------

Q. I am linking C functions with C++ functions. The linker reports that

all of my C functions are undefined. Why?

A. Linking C++ modules with C modules requires the use of a linkage

specification. Prototypes for C functions within C++ modules must

be in one of the following forms:

extern "C" declaration

extern "C" { declarations }

For example, if a C module contains functions

"char *SCopy(char*, char*);" and "void ClearScreen(void)", they

must be declared in a C++ module in one of the following ways:

extern "C" char *SCopy(char*, char*);

extern "C" void ClearScreen(void);

or

extern "C" {

char *SCopy(char*, char*)

void ClearScreen(void);

}

For further examples, see the standard header files. For additional

comment, see Common C++ Questions.

Q. Why do I get the message:

Linker Error: Unable to open input file 'C0x.OBJ'

A. See the "Integrated Environment" section above.

Q. Why do I get the message:

Linker Error: Undefined symbol '_main' in module C0

A. Every C program must contain a function called main(). This

is the first function executed in your program. The function

name must be all in lower case. If your program does not

have one, create one. If you are using multiple source files,

the file that contains the function main() must be one of

the files listed in the Project.

Note that an underscore character '_' is prepended to all

external Turbo C++ symbols.

Q. Why does the linker tell me that all the graphics library

routines are undefined?

A. See the "Integrated Environment" and "Command-line Compiler"

sections above.

Q. What is a 'Fixup overflow'?

A. See the listing of TLINK error messages in the Turbo C++

User's Guide.

Q. I am linking my own assembly language functions with Turbo C++.

The linker reports that all of my functions a

No comments:

Post a Comment