Page 2 of 2 FirstFirst 12
Results 11 to 20 of 20

Thread: g++ and gcc , cant find libraries

  1. #11
    Join Date
    Jan 2008
    Beans
    211

    Re: g++ and gcc , cant find libraries

    Quote Originally Posted by gmargo View Post
    That's a pretty big problem. Have you installed the build-essential package?
    It seems build-essential was not installed , but still i am having the trouble like.


    Code:
    In file included from /usr/include/c++/4.3/bits/postypes.h:47,
                     from /usr/include/c++/4.3/iosfwd:47,
                     from /usr/include/c++/4.3/ios:44,
                     from /usr/include/c++/4.3/istream:45,
                     from /usr/include/c++/4.3/fstream:45,
                     from libvistax.h:5:
    Code:
    libvistax.h: In function ‘int passw(char*)’:
    libvistax.h:24: error: ‘strcpy’ was not declared in this scope
    libvistax.h: In function ‘int wtest(char*)’:
    libvistax.h:35: error: ‘strcpy’ was not declared in this scope
    libvistax.h:36: error: ‘ofstream’ was not declared in this scope
    libvistax.h:36: error: expected ‘;’ before ‘tet’
    libvistax.h:37: error: ‘strcat’ was not declared in this scope
    libvistax.h:38: error: ‘tet’ was not declared in this scope
    libvistax.h:45: error: ‘system’ was not declared in this scope
    libvistax.h:49: error: ‘cout’ was not declared in this scope
    libvistax.h: In function ‘void alcen(char*)’:
    libvistax.h:56: error: ‘strlen’ was not declared in this scope
    libvistax.h:57: error: ‘cout’ was not declared in this scope
    libvistax.h:58: error: ‘cout’ was not declared in this scope
    libvistax.h: In function ‘int random(int)’:
    
    
    and lot more..till end

  2. #12
    Join Date
    Nov 2007
    Location
    UK
    Beans
    772
    Distro
    Ubuntu 8.04 Hardy Heron

    Re: g++ and gcc , cant find libraries

    Have you included the correct header files?
    Also, have you included the std namespace?

    Code:
    using namespace std;
    Disclaimer: Yes I usually talk crap

  3. #13
    Join Date
    Jan 2008
    Beans
    211

    Re: g++ and gcc , cant find libraries

    using "name space std" solved that problem

    thank you everyone BUT i am having a new trouble,

    i am using netbeans IDE and it is giving an error that

    fstream, iostream, stdio.h, unistd

    have unresolved includes in them, ..what should i do.

    is there somehow i can get the old original iosteam.h , fstream.h and other binaries
    the new set is just a mess.

    Please help. Thanks in advance

  4. #14
    Join Date
    Apr 2008
    Location
    UK
    Beans
    496
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: g++ and gcc , cant find libraries

    Indeed, it was never going to work without using namespace std or a std:: prefix. You need to remember that in C++, functions are called relative to a namespace.

    I would personally recommend when you're starting out programming cpp that you start on the command line - this way you can much more easily grasp the basic concepts. When you can code simple programs straight, write the compilation commands, etc, then you've got a solid starting point to move to a GUI-based IDE. IDEs, in my experience, tend to make large projects slightly more manageable, and small projects longer & harder. Anyway...

    Unresolved includes probably means your header paths are set incorrectly - in your case, in the NetBeans IDE preferences.
    Ace1 FreeBSD/Gnome 2, i5 2300, 16GB, HX750W, 20TB ZFS pool, 60GB SSD, Fractal Design XL
    Ace2 Ubuntu/Xubuntu, i7 2600, 16GB, HX850W, 4TB, Asus HD6970, Fractal Design R3
    Ace3 Ubuntu/XFCE, E7200, 4GB, OCZ GameXStream 700W, 8TB

  5. #15
    Join Date
    Jan 2008
    Beans
    211

    Re: g++ and gcc , cant find libraries

    Quote Originally Posted by stderr View Post
    Indeed, it was never going to work without using namespace std or a std:: prefix. You need to remember that in C++, functions are called relative to a namespace.

    I would personally recommend when you're starting out programming cpp that you start on the command line - this way you can much more easily grasp the basic concepts. When you can code simple programs straight, write the compilation commands, etc, then you've got a solid starting point to move to a GUI-based IDE. IDEs, in my experience, tend to make large projects slightly more manageable, and small projects longer & harder. Anyway...

    Unresolved includes probably means your header paths are set incorrectly - in your case, in the NetBeans IDE preferences.

    I have been working on cpp for the last 5 years.
    and i made a switch to gcc and g++ only 2 years back.
    till then i used to use Turbo C++.
    and everything was fine first , then suddenly with an update, my compilers went absolutely mad, the iostream.h and fstream.h everything became iostream fstream ..etc. the till then i could do without "namespace std". and now it wont do without it.

    and the file.eof() function just vanished, it says there nothing exist calls eof.
    I am in middle of a important projecta nd it seems i have to rewrite the entire 80,000 lines of code again. to adjust to the new changes which i don't understand the reason for.

    + i am getting many unresolved dependencies from header files. it seems includes inside the header files are too missing.

    is there any way i can get my old compiler and libraries back.

  6. #16
    Join Date
    Apr 2008
    Location
    UK
    Beans
    496
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: g++ and gcc , cant find libraries

    Hmm, considering that I think we need to know more about what changed on your system to cause you all these problems.

    Can you crosscheck your recently updated/changed package list against the date/time you first started experiencing these problems?

    System->Admin->Synaptic, File->History.

    Also can you post the output of

    Code:
    ls -l $(whereis g++ | awk '{ print $2 }')
    and

    Code:
    sudo dpkg -l libstdc++*
    edit: I would add that the behavior you're now experiencing is what I've been used to for years, and that it's been my understanding that references such as <iostream.h> have been deprecated for many years, due to the introduction of namespaces. So I'm pretty interested to see what you have been using and what's happened... maybe such things have still been supported as deprecated for ages and now with g++ 4.4 they've finally removed support - don't know.
    Last edited by stderr; July 3rd, 2010 at 05:39 AM.
    Ace1 FreeBSD/Gnome 2, i5 2300, 16GB, HX750W, 20TB ZFS pool, 60GB SSD, Fractal Design XL
    Ace2 Ubuntu/Xubuntu, i7 2600, 16GB, HX850W, 4TB, Asus HD6970, Fractal Design R3
    Ace3 Ubuntu/XFCE, E7200, 4GB, OCZ GameXStream 700W, 8TB

  7. #17
    Join Date
    Apr 2008
    Location
    UK
    Beans
    496
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: g++ and gcc , cant find libraries

    You'd probably have success rolling back to an early g++ version and early libs - something like this:

    http://www.linuxquestions.org/questi...ream-h-734338/
    Ace1 FreeBSD/Gnome 2, i5 2300, 16GB, HX750W, 20TB ZFS pool, 60GB SSD, Fractal Design XL
    Ace2 Ubuntu/Xubuntu, i7 2600, 16GB, HX850W, 4TB, Asus HD6970, Fractal Design R3
    Ace3 Ubuntu/XFCE, E7200, 4GB, OCZ GameXStream 700W, 8TB

  8. #18
    Join Date
    Jan 2008
    Beans
    211

    Re: g++ and gcc , cant find libraries

    Quote Originally Posted by stderr View Post
    You'd probably have success rolling back to an early g++ version and early libs - something like this:

    http://www.linuxquestions.org/questi...ream-h-734338/


    You were rite, the problem was due to the updated libraries and compiler.

    it seems compiling in command line solves a great deal of problem.
    and a few renaming made easier, though i am sure that somewhere
    in future i may face a few errors as i have renamed iostream to iostream.h and etc.

    Thanks for all your kind support,
    You guys make linux Beat.

  9. #19
    Join Date
    Aug 2008
    Beans
    573

    Re: g++ and gcc , cant find libraries

    Does anyone know what caused these problems?

  10. #20
    Join Date
    Apr 2008
    Location
    UK
    Beans
    496
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: g++ and gcc , cant find libraries

    Glad you got it working again lordbux Good luck with the rest of the project!

    edit, @cokedude: It would seem to have been the use of deprecated syntax that appears to have been removed from the g++ compiler relatively recently, the solution to which could be either to go through all the code and update it (rather impractical in lordbux's 80k line project!), or use an earlier version of the compiler.

    I had quite an advantage in a sense, in that by the time I came to learn C++ everyone was using namespaces and the newer libraries, so I skipped an extra phase of transition.
    Last edited by stderr; July 3rd, 2010 at 06:38 AM.
    Ace1 FreeBSD/Gnome 2, i5 2300, 16GB, HX750W, 20TB ZFS pool, 60GB SSD, Fractal Design XL
    Ace2 Ubuntu/Xubuntu, i7 2600, 16GB, HX850W, 4TB, Asus HD6970, Fractal Design R3
    Ace3 Ubuntu/XFCE, E7200, 4GB, OCZ GameXStream 700W, 8TB

Page 2 of 2 FirstFirst 12

Bookmarks

Posting Permissions

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