Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: CRY FOR HELP: please explain an microsift C error

Author: James Swafford

Date: 14:04:24 06/11/00

Go up one level in this thread


On June 11, 2000 at 08:58:31, JW de Kort wrote:

>Dear friends
>
>I have started working with microsoft 4.1 recently and i have ran
>into a problem i cannot solve. It is very basic and it should
>be very easy to answer for some of you.
>
>My project consists of two files.
>In one file i try to call a function defined in the other file.
>This is not possibel because of two errors i get in the linking
>fase: lnk1120 and lnk2001. Of course i checked the documentation
>but without any succes.
>I'am using header files -of course-. I do not use MFC.
>This code used to compile perfectly under turbo c 3.1 (for Dos).
>
>This is about what causes the problem:
>
>fil1.cpp
>
>#include file2.h
>void function (void)
>{
>
>  funct2 ();  //call function in the oterh file
>}
>
>file2.h
>
>extern void funct2(void);
>
>
>file 2
>
>void funct2(void)
>{
>
>}
>
>
>Please. help me out. You have helped me before, please don't let me down this
>time. This must be a trivial problem that is easy to solve.
>
>Thanks in advance!
>
>Jan WIllem

Hi Jan,

In file2.h, lose the "extern" before the function prototype.
Use extern for variables, not functions.  After that,
you should be ok. :-)

--
James




This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.