Hans Sperker
Hans Sperker

Reputation: 1347

TCHAR and _tprintf under Mac OSX

I am playing around with clucene under mac osx with xcode and have some problems with the demo application, maybe someone can help me with that :-)

The demo code comes with 'document' and 'query' arrays:

const TCHAR* docs[] = {
  _T("a b c d e"),
  ...
  _T("a c e a b c"),
  NULL
};

const TCHAR* queries[] = {
  _T("a b"),
  ...
  _T("\"a c e\""),
  NULL
};

which are used for indexing and as queries which work good as long as i comment out the _tprintf lines like:

_tprintf(_T("Query: %s\n"), qryInfo);

so _tprintf seems to be unrecognized by my system and if I use tprintf xcode says there is no matching function for call to tprintf.

So how do I print TCHARs correctly? CLucene needs TCHAR names for Fields.

Thanks in advance!

Upvotes: 1

Views: 6644

Answers (2)

Darren
Darren

Reputation: 25619

TCHAR is a Windows character type. On non-Windows platforms, Clucene defines the TCHAR type and related functions in config/repl_tchar.h.

Either that header is not being included, or the project is misconfigured.

Upvotes: 1

Bo Persson
Bo Persson

Reputation: 92321

On Windows, TCHAR is either wchar_t or plain char depending on your project settings.

Likewise, _tprintf is either wprintf of printf to match the choice of characters.

On OSX you will likely have to make this choice yourself, perhaps

#define _tprintf    wprintf

Upvotes: 3

Related Questions