Thread: Problem with #include <list>

  1. #1
    Registered User
    Join Date
    Dec 2008
    Posts
    66

    Problem with #include <list>

    I have installed NetBeans 6.7.1 IDE and Cygwin.

    I have a c++ class file and as soon as I add
    Code:
    #include <list>
    I get a ton of errors:

    Code:
    In file included from /usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/list:74,
                     from LinDicT.cpp:4:
    /usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/bits/list.tcc:68: error: expected init-declarator before '<' token
    /usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/bits/list.tcc:68: error: expected `;' before '<' token
    /usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/bits/list.tcc:83: error: expected nested-name-specifier before "list"
    /usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/bits/list.tcc:83: error: expected init-declarator before '<' token
    /usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/bits/list.tcc:83: error: expected `;' before '<' token
    /usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/bits/list.tcc:93: error: expected nested-name-specifier before "list"
    /usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/bits/list.tcc:93: error: expected init-declarator before '<' token
    /usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/bits/list.tcc:93: error: expected `;' before '<' token
    /usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/bits/list.tcc:104: error: expected init-declarator before '<' token
    /usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/bits/list.tcc:104: error: expected `;' before '<' token
    /usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/bits/list.tcc:118: error: expected constructor, destructor, or type conversion before '<' token
    /usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/bits/list.tcc:118: error: expected `;' before '<' token
    /usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/bits/list.tcc:140: error: expected init-declarator before '<' token
    /usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/bits/list.tcc:140: error: expected `;' before '<' token
    /usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/bits/list.tcc:155: error: expected init-declarator before '<' token
    /usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/bits/list.tcc:155: error: expected `;' before '<' token
    /usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/bits/list.tcc:172: error: expected init-declarator before '<' token
    /usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/bits/list.tcc:172: error: expected `;' before '<' token
    /usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/bits/list.tcc:189: error: expected init-declarator before '<' token
    /usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/bits/list.tcc:189: error: expected `;' before '<' token
    /usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/bits/list.tcc:209: error: expected init-declarator before '<' token
    /usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/bits/list.tcc:209: error: expected `;' before '<' token
    /usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/bits/list.tcc:236: error: expected init-declarator before '<' token
    /usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/bits/list.tcc:236: error: expected `;' before '<' token
    /usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/bits/list.tcc:274: error: expected init-declarator before '<' token
    /usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/bits/list.tcc:274: error: expected `;' before '<' token
    /usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/bits/list.tcc:292: error: expected init-declarator before '<' token
    /usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/bits/list.tcc:292: error: expected `;' before '<' token
    /usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/bits/list.tcc:312: error: expected init-declarator before '<' token
    /usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/bits/list.tcc:312: error: expected `;' before '<' token
    /usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/bits/list.tcc:340: error: expected init-declarator before '<' token
    /usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/bits/list.tcc:340: error: expected `;' before '<' token
    I would appreciate greatly if someone could tell me how to make these errors go away.

  2. #2
    Registered User
    Join Date
    Apr 2004
    Location
    Ohio
    Posts
    147
    This sounds like a problem with your installation above anything else. I would ask for support with your Cygwin installation on their support forums.

    What you didn't mention was what C++ compiler you have set up. Judging by your file paths you've got the GNU C++ compiler. It could be that installation as well. I would ask around in the GNU support documentation and their mailing list for support.

  3. #3
    Kiss the monkey. CodeMonkey's Avatar
    Join Date
    Sep 2001
    Posts
    937
    Where are you adding that include? Post the surrounding code... it might be inside a class or something scary.
    "If you tell the truth, you don't have to remember anything"
    -Mark Twain

  4. #4
    Registered User
    Join Date
    Jun 2005
    Posts
    6,815
    The other possibility is that you've used some option that causes compilation as C, not as C++ (eg using gcc, not g++). C-only compilers tend to complain rather bitterly when they are forced to parse the contents of C++ standard headers (or any other C++-specific code).
    Right 98% of the time, and don't care about the other 3%.

    If I seem grumpy or unhelpful in reply to you, or tell you you need to demonstrate more effort before you can expect help, it is likely you deserve it. Suck it up, Buttercup, and read this, this, and this before posting again.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Problem with simple socket client/server program
    By spencer88 in forum C Programming
    Replies: 6
    Last Post: 05-05-2009, 11:05 PM
  2. debug assertion failed!
    By chintugavali in forum C Programming
    Replies: 4
    Last Post: 12-11-2007, 06:23 AM
  3. include problem
    By Strait in forum C++ Programming
    Replies: 4
    Last Post: 01-31-2005, 04:01 PM
  4. Read and write hanging
    By zee in forum C Programming
    Replies: 8
    Last Post: 08-03-2004, 11:19 PM
  5. help with finding lowest number entered
    By volk in forum C++ Programming
    Replies: 12
    Last Post: 03-22-2003, 01:21 PM