www.digitalmars.com         C & C++   DMDScript  

c++ - Precompiled Headers and STL

reply ddiego users.sourceforge.net writes:
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 21 2004
next sibling parent ddiego users.sourceforge.net writes:
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 21 2004
prev sibling parent "Walter" <newshound digitalmars.com> writes:
Compile with -cpp to tell the compiler that test.h is a C++ file, not a C
file.
May 22 2004