← Back to team overview

kicad-developers team mailing list archive

Re: strtok_r not detected properly

 

On 03/12/2014 05:57 PM, Dick Hollenbeck wrote:
On 03/12/2014 11:28 AM, David Novak wrote:
When building Pcbnew, I get an error message indicating that strtok_r is
being redefined. The offending code is in kicad_string.h.

#ifndef HAVE_STRTOKR
// common/strtok_r.c optionally:
extern "C" char* strtok_r( char* str, const char* delim, char** nextp );
#endif

I tracked HAVE_STRTOKR to an auto detection inside
PerformFeatureChecks.cmake.

check_symbol_exists( strtok_r "string.h" HAVE_STRTOKR )

Fore some reason, this check is failing even though strtok_r is defined.
Presumably, the check is looking in the wrong file. I tried adjusting
this line, but without success.

As a quick fix I added

#define HAVE_STRTOKR

just prior to the check in kicad_string.h.

I'm on Windows using TDM-GCC 4.8.1-3.

What is the correct check_symbol_exists() line to fix this problem?


We concluded there's an edit needed in one of your TDC-GCC compiler headers.

Hi Dick,

Wouldn't it be a better idea to simply replace strtok_r (used only in legacy_plugin.cpp AFAIK) and have a UTF8 or std::string token splitting function, that is more in line with object oriented languages like C++?

Cheers,
Tom


Follow ups

References