A4 (B5 Platform) Discussion Discussion forum for the B5 Audi A4 produced from 1995-2001 B5 FAQ

hardcore C gurus! (+ audi content)

Thread Tools
 
Search this Thread
 
Old 09-16-2001, 07:57 PM
  #1  
AudiWorld Super User
Thread Starter
 
LessCode MoreBeer's Avatar
 
Join Date: Aug 2000
Posts: 2,058
Likes: 0
Received 2 Likes on 2 Posts
Default hardcore C gurus! (+ audi content)

audi content: went to marina for the autoX and got turned away for being 15 minutes late...ok everyone, be early! argh, what a waste. Not a total waste of the day, got an orbital buffer...can't wait to test it out!!

ok, here's the prob. Using gcc 2.95.2 on linux: A header which is ultimately included from a cpp file includes <memory>. On the #include <memory> line I get tons of compile errors in the std headers (stl_tempbuf, stl_uninitialized) of "template with C linkage".

any ideas? gawd daymit =)
Old 09-16-2001, 08:14 PM
  #2  
New Member
 
jasonSD's Avatar
 
Join Date: Sep 2001
Posts: 2
Likes: 0
Received 0 Likes on 0 Posts
Default

Do you have "using namespace std;" after the include?
Old 09-16-2001, 08:29 PM
  #3  
AudiWorld Super User
Thread Starter
 
LessCode MoreBeer's Avatar
 
Join Date: Aug 2000
Posts: 2,058
Likes: 0
Received 2 Likes on 2 Posts
Default didn't have it, but tried it, no help :(

it actually gives the compile error while parsing the std includes. further note: gcc seems to have just copied the HP std files
Old 09-16-2001, 08:40 PM
  #4  
Member
 
Matt Turbo's Avatar
 
Join Date: Jan 2001
Posts: 2,300
Likes: 0
Received 0 Likes on 0 Posts
Default I take it you mean C++...

#include <memory>
seems like it would be a C++ STL...
Old 09-16-2001, 08:41 PM
  #5  
New Member
 
jasonSD's Avatar
 
Join Date: Sep 2001
Posts: 2
Likes: 0
Received 0 Likes on 0 Posts
Default

Try using g++ to compile it
Old 09-16-2001, 08:42 PM
  #6  
New Member
 
atoi's Avatar
 
Join Date: Aug 2001
Posts: 98
Likes: 0
Received 0 Likes on 0 Posts
Default Re: hardcore C gurus! (+ audi content)

Your description is a bit brief, but I'll take a stab at it. It
sounds like memory.h is being included from within an extern "C" {}
block of a c++ file. Since it's being included from a c++ file, it
uses templates (when included from a c file it doesnt). But, from
inside the extern "C" {} block, all that fancy c++ stuff is useless so
the compiler complains. The trick is to make sure that memory.h gets
included early, before the extern "C" {} block that is now including
it. This way the guard against multiple inclusion (#ifndef _MEMORY_H)
will kick in and prevent the contents from getting parsed.
Old 09-16-2001, 08:45 PM
  #7  
Member
 
Matt Turbo's Avatar
 
Join Date: Jan 2001
Posts: 2,300
Likes: 0
Received 0 Likes on 0 Posts
Default

Agreed...I've heard G++ complains less than gcc
Old 09-16-2001, 08:55 PM
  #8  
AudiWorld Super User
Thread Starter
 
LessCode MoreBeer's Avatar
 
Join Date: Aug 2000
Posts: 2,058
Likes: 0
Received 2 Likes on 2 Posts
Default

i tried, didn't fix it either
Old 09-16-2001, 08:58 PM
  #9  
AudiWorld Super User
Thread Starter
 
LessCode MoreBeer's Avatar
 
Join Date: Aug 2000
Posts: 2,058
Likes: 0
Received 2 Likes on 2 Posts
Default ya, that sounds like the problem but I ran through the tree of includes and didn't see any

extern "C" around the path to <memory>....I'll check again.

btw, this isn't memory.h it's <memory>

no .h so STL.
Old 09-16-2001, 09:10 PM
  #10  
New Member
 
atoi's Avatar
 
Join Date: Aug 2001
Posts: 98
Likes: 0
Received 0 Likes on 0 Posts
Default Dont bother looking...

There's no need to actually look for the problem Just try
the fix. If it works, go back and find the problem. Stick
a #include <memory> before any of the other includes. It wont
hurt anything and *might* get you going.


Quick Reply: hardcore C gurus! (+ audi content)



All times are GMT -8. The time now is 04:01 PM.