[aspectc-user] Can't use string objects in *.ah files

Goh, Betty betty.goh at glenayre.com
Thu Mar 6 03:05:39 CET 2003


Dear all,

I'm trying to build a small sample which uses string objects.

I've included the string header file in the Action.ah file and declared a
string variable like so:
std::string abc = "abcd";

When I try to compile, I get a bunch of errors involving the g++
./ac++ -v9 -Iexamples/Sample -p examples/Sample -d examples/Sample-out
* Running AspectC++ 0.7pre1
* Simple Dependency Check
  - new or modified: examples/Sample/Action.ah
* Handling Translation Unit `main.cc'.
  - Path "examples/Sample/main.cc"

/usr/include/g++-3/std/straits.h:108: error: redefinition of
`string_char_traits'
/usr/include/g++-3/std/straits.h:40: previously defined here
/usr/include/g++-3/std/straits.h:108: error: invalid declaration near token
`{'
/usr/include/g++-3/stl_alloc.h:221: error: expected type `__inst', got type
`int' for argument 1
/usr/include/g++-3/stl_alloc.h:221: error: invalid declaration near token
`<'
/usr/include/g++-3/stl_alloc.h:451: error: expected type `threads', got type
`int' for argument 1
/usr/include/g++-3/stl_alloc.h:451: error: invalid declaration near token
`<'
/usr/include/g++-3/stl_alloc.h:452: error: expected type `threads', got type
`int' for argument 1
/usr/include/g++-3/stl_alloc.h:452: error: invalid declaration near token
`<'
/usr/include/g++-3/stl_alloc.h:460: error: invalid declaration near token
`<'
/usr/include/g++-3/stl_alloc.h:703: error: `_NFREELISTS' undeclared here
/usr/include/g++-3/stl_iterator.h:795: error: invalid declaration near token
`<'
/usr/include/g++-3/stl_iterator.h:847: error: invalid declaration near token
`<'
/usr/include/g++-3/stl_iterator.h:899: error: invalid declaration near token
`<'
/usr/include/g++-3/std/bastring.h:436: error: invalid declaration near token
`<'
/usr/include/g++-3/std/bastring.h:651: error: invalid declaration near token
`<'
/usr/include/g++-3/std/bastring.h:653: error: invalid declaration near token
`<'
/usr/include/g++-3/std/bastring.h:655: error: invalid declaration near token
`<'
/usr/include/g++-3/std/bastring.cc:29: error: invalid declaration near token
`<'
/usr/include/g++-3/std/bastring.cc:520: error: invalid declaration near
token `<'
/usr/include/g++-3/string:9: error: invalid declaration near token `<'
examples/Sample/Action.ah:12: error: `std::string' is not a member of
`std::string'
examples/Sample/Action.ah:12: error: invalid member declaration near token
`abc'
make: *** [sample] Error 1

What could the problem be? Can we use string objects in *.ah files? And
also, do we have to use extension cc for our main? Because when I named my
main as main.cpp, nothing is done on the main file.

Thanks.

regards,
Betty





More information about the aspectc-user mailing list