Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #107864

Need help fixing a "previously defined" error

Newsgroups comp.lang.c
Subject Need help fixing a "previously defined" error
From Peabody <waybackNO584SPAM44@yahoo.com>
Date 2017-04-08 08:07 -0500
Message-ID <20170408-130720.9.0@Peabody.ssl.astraweb.com> (permalink)
Organization Unlimited download news at news.astraweb.com

Show all headers | View raw


As will shortly be obvious, I'm completely new to C.  I'm trying to 
modify and recompile a Texas Instruments program called BSLDEMO2.exe 
which is used to flash new firmware to some of their MSP430 
microprocessors using a boot-strap loader. I need to invert the DTR line. 
They provide the source code, which they compiled using a Microsoft 
compiler.  I'm using LCC.  And this is C, not C++.

Before addressing the change I want to make, I'm just trying to get the 
original source to compile in LCC.  I'm getting a "previously defined" 
error that I don't quite know how to deal with.

The file is TI_TXT_Files.h, and it starts off this way:

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

#ifndef _TI_TXT_Files_H_
#define _TI_TXT_Files_H_

/***********************/
/* Function prototypes */
/***********************/

char* strtrim(char* lpszA);
BOOL GetAddress(char* Record, unsigned long* ulAddress);
BOOL GetBytes(char* Record, BYTE Bytes[], unsigned int* ByteCnt);

long Load_Ti_Txt(LPTSTR File);

//-- StartTITextOutput 

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

LCC says "strtrim" is previously defined in the #included <string.h>.

I guess the first question is what that char* line is doing. The second 
question is why didn't TI get this error when they compiled it.  But 
the main question is how to fix it.

LCC's string.h has this:

#ifndef __ANSIC__ONLY__
short *  memshort(const short *,short,size_t);
unsigned short *memushort(const unsigned short *,unsigned short,size_t);
int *    memint(const int *,int,size_t);
unsigned int *memuint(const unsigned int *,unsigned int,size_t);
long long *memll(const long long *,long long,size_t);
unsigned long long *memull(const unsigned long long *,unsigned long 
long,size_t);
char    *strupr(char *);
char    *strlwr(char *);
char    *strnupr(char *,size_t);
char    *strnlwr(char *,size_t);
int      strtrim(char *);           <============= here
char    *strrev(char *);
#endif

On the surface there seems to be a conflict between the char* and the int 
declarations.  But that's probably because I don't understand what's 
going on.

There are no other instances of "strtrim" appearing anywhere in the TI 
source code.

It seems that the safest way to deal with this might be to make a copy of 
string.h with the strtrim declaration commented out, and move it up to 
the source code folder, and change all <string.h> #includes to 
"string.h".  Would that work?  Is there a better way?

I would appreciate any suggestions.

Back to comp.lang.c | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

Need help fixing a "previously defined" error Peabody <waybackNO584SPAM44@yahoo.com> - 2017-04-08 08:07 -0500
  Re: Need help fixing a "previously defined" error James Kuyper <jameskuyper@verizon.net> - 2017-04-08 10:47 -0400
    Re: Need help fixing a "previously defined" error Peabody <waybackNO584SPAM44@yahoo.com> - 2017-04-08 12:51 -0500
      Re: Need help fixing a "previously defined" error Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-04-08 20:03 +0100
      Re: Need help fixing a "previously defined" error Spiros Bousbouras <spibou@gmail.com> - 2017-04-08 19:06 +0000
      Re: Need help fixing a "previously defined" error James Kuyper <jameskuyper@verizon.net> - 2017-04-08 15:17 -0400
  Re: Need help fixing a "previously defined" error Spiros Bousbouras <spibou@gmail.com> - 2017-04-08 15:29 +0000
  Re: Need help fixing a "previously defined" error Barry Schwarz <schwarzb@dqel.com> - 2017-04-08 09:21 -0700
    Re: Need help fixing a "previously defined" error Peabody <waybackNO584SPAM44@yahoo.com> - 2017-04-08 13:04 -0500
      Re: Need help fixing a "previously defined" error James Kuyper <jameskuyper@verizon.net> - 2017-04-08 15:33 -0400
        Re: Need help fixing a "previously defined" error Spiros Bousbouras <spibou@gmail.com> - 2017-04-08 19:51 +0000
        Re: Need help fixing a "previously defined" error Peabody <waybackNO584SPAM44@yahoo.com> - 2017-04-08 16:24 -0500
    Re: Need help fixing a "previously defined" error Keith Thompson <kst-u@mib.org> - 2017-04-08 18:45 -0700
  Re: Need help fixing a "previously defined" error bartc <bc@freeuk.com> - 2017-04-08 17:46 +0100
    Re: Need help fixing a "previously defined" error Peabody <waybackNO584SPAM44@yahoo.com> - 2017-04-08 13:19 -0500
  Re: Need help fixing a "previously defined" error David Brown <david.brown@hesbynett.no> - 2017-04-09 12:38 +0200
    Re: Need help fixing a "previously defined" error Peabody <waybackNO584SPAM44@yahoo.com> - 2017-04-09 07:52 -0500
      Re: Need help fixing a "previously defined" error David Brown <david.brown@hesbynett.no> - 2017-04-09 17:02 +0200
        Re: Need help fixing a "previously defined" error Peabody <waybackNO584SPAM44@yahoo.com> - 2017-04-09 18:20 -0500
          Re: Need help fixing a "previously defined" error James Kuyper <jameskuyper@verizon.net> - 2017-04-09 22:06 -0400
          Re: Need help fixing a "previously defined" error David Brown <david.brown@hesbynett.no> - 2017-04-10 09:07 +0200
            Re: Need help fixing a "previously defined" error Peabody <waybackNO584SPAM44@yahoo.com> - 2017-04-10 09:11 -0500
              Re: Need help fixing a "previously defined" error David Brown <david.brown@hesbynett.no> - 2017-04-10 17:31 +0200
                Re: Need help fixing a "previously defined" error Peabody <waybackNO584SPAM44@yahoo.com> - 2017-04-10 12:48 -0500

csiph-web