Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: question about errors when I change my C code to C++

Author: Dann Corbit

Date: 14:20:25 02/24/03

Go up one level in this thread


On February 24, 2003 at 17:03:45, Uri Blass wrote:

>On February 24, 2003 at 16:44:24, Dann Corbit wrote:
>
>>On February 24, 2003 at 16:27:09, Uri Blass wrote:
>>
>>>I try to change my C files to C++ after advice that I got when people told me
>>>that inline functions are better macro(note that I do not know why they are
>>>better but I found that C++ give me better warning than C for some reason.
>>>
>>>The problem is that for some reason I also get errors that I do not understand.
>>>
>>>I get the following errors for some varaibles when I change my C files to CPP
>>>files
>>>
>>>error LNK2001: unresolved external symbol "int *  info" (?info@@3QAHA)
>>>
>>>Note that it is only for varaibles that I used for them the following trick
>>>
>>>int PADDED_info[80];
>>>int * const info = PADDED_info+8;
>>>
>>>I have in data.h
>>>extern int * const info;
>>>I do not understand what is the problem.
>>
>>Probably, you have a mix of C and C++ files.
>>If so, the C++ routines will not see the C functions because of something called
>>"name mangling" that changes the format of the name that the linker will see.
>>There are several ways to fix it.  Here are two possibilities:
>>
>>1.  Change all the files to C++ files at the same time.
>>2.  Use extern "C" declarations for the C functions you must access
>
>
>No
>
>I have only 4 c files and I changed them to cpp files(the message that I get is
>only compiling main.cpp and the same for 3 different files when I rebuild
>movei).
>
>Maybe it is better if I have more files and I see that other do it but basically
>I started by coping the file structure of tscp
>except the fact that I have only one file for search and evaluation(my
>evaluation is small and part of it is also done inside makemove because movei
>evaluate every node).
>
>I do not know what is the advantage of having a lot of files.

Delete all the object files and build again.  Rename does not change the date of
the file, typically.  If you have converted them all, you should not see this
problem.



This page took 0.02 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.