Find the answer to your Linux question:
Results 1 to 8 of 8
I have no idea what GCC is doing. I didn't even mess with GCC ( i dont know how!).... I got Java installed, setup, etc. etc., and then went to ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Linux Newbie Arkhan's Avatar
    Join Date
    Sep 2006
    Location
    Earth
    Posts
    150

    Strangest GCC error ever... what do I do! :(


    I have no idea what GCC is doing. I didn't even mess with GCC ( i dont know how!).... I got Java installed, setup, etc. etc., and then went to make sure GCC compiled my C++ stuff properly.... and well.....

    heres the source file

    Code:
    #include <iostream>
    using namespace std;
    int main()
    {
       cout <<"It works";
       return 0;
    }
    pretty straight forward right?


    I get this as my compile error when i run gcc test.cpp
    Code:
    [Arkhan@192 ~]$ gcc test.cpp
    In file included from /usr/include/bits/posix1_lim.h:153,
                     from /usr/include/limits.h:145,
                     from /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h:122,
                     from /usr/lib/gcc/i386-redhat-linux/4.1.2/include/syslimits.h:7,
                     from /usr/lib/gcc/i386-redhat-linux/4.1.2/include/limits.h:11,
                     from /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../../include/c++/4.1.2/climits:50,
                     from /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_algobase.h:66,
                     from /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/char_traits.h:46,
                     from /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../../include/c++/4.1.2/ios:45,
                     from /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../../include/c++/4.1.2/ostream:44,
                     from /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../../include/c++/4.1.2/iostream:44,
                     from test.cpp:1:
    /usr/include/bits/local_lim.h:36:26: error: linux/limits.h: No such file or directory

    what in the world is going on there. I even tried compiling using Geany (Thats a neat little IDE!) and it still blows the hell up....


    *grumble grumble*

  2. #2
    Linux Engineer
    Join Date
    Nov 2004
    Location
    home
    Posts
    796
    I'm thinking maybe your kernel headers package wasn't installed properly. Look through the package manager and be sure it is installed, or reinstalled if nessecary.

  3. #3
    Linux Newbie Arkhan's Avatar
    Join Date
    Sep 2006
    Location
    Earth
    Posts
    150
    Errr im kind of nubtarded. What exactly am I looking for there.

    thanks!

  4. #4
    Blackfooted Penguin daark.child's Avatar
    Join Date
    Apr 2006
    Location
    West Yorks
    Posts
    4,393
    This is a C++ app, so have you tried using g++ instead of gcc? e.g.
    Code:
    g++ test.cpp -o test
    ./test

  5. #5
    Linux Newbie Arkhan's Avatar
    Join Date
    Sep 2006
    Location
    Earth
    Posts
    150
    Quote Originally Posted by daark.child View Post
    This is a C++ app, so have you tried using g++ instead of gcc? e.g.
    Code:
    g++ test.cpp -o test
    ./test

    same error.

    When you compile .cpp with Geany or Anjuta, it uses G++

    they both give an identical error,

  6. #6
    Blackfooted Penguin daark.child's Avatar
    Join Date
    Apr 2006
    Location
    West Yorks
    Posts
    4,393
    Thats strange because everything works perfectly fine for me. I used KATE to write the code below
    Code:
    #include <iostream>
    using namespace std;
    int main(void)
    {
    	cout << "It works!\n";
    	return 0;
    }
    I then did
    Code:
    user@host:~/development/cpp> g++ test.cpp -o test
    user@host:~/development/cpp> ./test
    It works!
    user@host:~/development/cpp>

  7. #7
    Linux Newbie Arkhan's Avatar
    Join Date
    Sep 2006
    Location
    Earth
    Posts
    150
    well..... I know its strange. Thats why I made the thread, lol.


    I tried updating the kernel-devel file, it installed......but the problem persists.


    any other ideas

  8. #8
    Linux Newbie Arkhan's Avatar
    Join Date
    Sep 2006
    Location
    Earth
    Posts
    150
    uninstalled/reinstalled kernel-header thing.......

    works now!

    and if i try it with GCC instead of G++, it totally blows up hehehe. oops

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •