I’m using a GNU C/C++ compiler for a work project. The particular compiler is newer than what I’ve used in the past, and it’s actually a cross compiler.
I’m having multiple problems getting it to work properly. So far, everything can be chalked up to (re)learning curve and :smack: moments, but I still can’t get the stupid thing to digest STL template classes. The particular problem I’m seeing is that I include <list>, but <iterator> starts flagging nonsensical syntax errors. FWIW, I haven’t included <iterator>.
When I used GNU C++ in an academic environment (native mode), I had 0 problems. Similarly, the code I’m working with now was originally written in Visual C++, and it compiled just fine there, too.
I’ve spent 2 days now combing the GCC MAN pages for anything related to compiler switches or other options to indicate use of template classes, and I’ve come up empty. Help?!?
Are you compiling using gcc or g++? There are subtle differences between the two which can cause problems compiling C++ code with gcc. I’m not sure if that can cause problems compiling <list>, though.
Try reading the G++ Manual. For templates in particular, read this section. Templates can be nasty creatures to compile. I usually use the -frepo switch, but you need to understand what you’re code is trying to do to choose wisely.
Edit: Oh, if you do play around with the template options, be sure to delete all *.o and *.rpo files before recompiling. Your make file should have a clean option to do this easily.