Thread overview
Precompiled Headers and STL
May 22, 2004
ddiego
May 22, 2004
ddiego
May 23, 2004
Walter
May 22, 2004
Hi, I am trying to get precompiled headers to work with DMC and tried the following:

test.h contents:

#ifndef _TEST_H__
#define _TEST_H__



#include <stddef.h>
#include <string>
#include <stdio.h>

typedef wchar_t WideChar;

typedef std::basic_string<WideChar> String;


#endif //_TEST_H__



then on the commandline (using Cygwin if that matters)

sc -Ar -Ae -HF./test.sym ./test.h

I get the following errors:

extern "C++" {
^
e:\dm\bin\..\include\../include/new.h(28) : Error: '=', ';' or ',' expected
}
^
e:\dm\bin\..\include\../include/new.h(45) : Error: identifier or '( declarator )
' expected
Error e:\dm\bin\..\include\../include/exception 14:  Use C++ compiler for except
ion
--- errorlevel 1


I am using dmc:
"Digital Mars Compiler Version 8.38n"

with the STL that's provided on the website (STL 4.5.3)

I looked around the website a bit, but didn't find anything obvious to help out - did I miss something or have I stumbled onto a bug?

Thanks !

Jim Crafton


May 22, 2004
In article <c8mmvp$2fl4$1@digitaldaemon.com>, ddiego@users.sourceforge.net says...
>
>Hi, I am trying to get precompiled headers to work with DMC and tried the following:



Oops - I guess I may have posted this too soon, on reading a little closer I
notice that the docs say:
"A header intended for precompilation should, therefore, contain only
declarations and no definitions."

So I am assuming that makes stuff like template class declarations/definitions out of the question? Is there any kind of work around for this, say for STL, etc?

Thanks again!

Jim Crafton


May 23, 2004
Compile with -cpp to tell the compiler that test.h is a C++ file, not a C file.