Thread: Missing library?

  1. #1
    Registered User
    Join Date
    Aug 2006
    Posts
    23

    Missing library?

    Hi all,
    Trying to compile a simple c++ program: sparc - sun - solaris2.8

    Code:
    #include<iostream>
    #include<string>
    
    using namespace std;
    
    int main()
    {
    string h = "HELLO";
    cout<<h<<" world";
    
    }
    When I try to compile with gcc or g++:
    Undefined first referenced
    symbol in file
    cerr /tmp/cckNfzrE.o
    cout /tmp/cckNfzrE.o
    string_char_traits<char>::move(char *, char const *, unsigned int)/tmp/cckNfzrE.o
    endl(ostream &) /tmp/cckNfzrE.o
    __out_of_range(char const *) /tmp/cckNfzrE.o
    ostream:perator<<(ostream &(*)(ostream &))/tmp/cckNfzrE.o
    ostream::write(char const *, int) /tmp/cckNfzrE.o
    string_char_traits<char>::length(char const *)/tmp/cckNfzrE.o
    __length_error(char const *) /tmp/cckNfzrE.o
    string_char_traits<char>::copy(char *, char const *, unsigned int)/tmp/cckNfzrE.o
    ostream:perator<<(char const *) /tmp/cckNfzrE.o
    ld: fatal: Symbol referencing errors. No output written to a.out
    collect2: ld returned 1 exit status

    Not sure why this simple program won't compile? Am I missing my libraries or something? Anyone else having this issue?

    Thx in advance

  2. #2
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    Is it possible you are using STLport?
    You will need to link with the stlport lib on that case. STLPort iostreams implementation is done through a library.
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  3. #3
    Registered User
    Join Date
    Aug 2006
    Posts
    23
    No, I directly log into our unix server and from the command line, I used to be able to compile c++ programs. Now I am receiving the error, like I am not including my libraries?

  4. #4
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    Strange...

    Check if by any chance you aren't compiling with gcc and linking with g++?
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  5. #5
    Registered User
    Join Date
    Aug 2006
    Posts
    23
    really strange, its driving me nutz!
    I did try to compile :
    gcc -Wall test.cc
    gcc -o test test.cc
    g++ -Wall test.cc
    g++ -o test test.cc

    Not sure what u mean about the linking? Where would the iostream file physically be, so that I could look for it possibly?

  6. #6
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    I suspect the server was changed to use stlport. The messages indicate the absence of iostreams references. This is typical of stlport implementation.

    try g++.exe -I./stlport test.cpp -L./lib/ -lstlport

    Also, phone them.
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  7. #7
    Registered User
    Join Date
    Aug 2006
    Posts
    23
    ksh: g++.exe: command not found

  8. #8
    Registered User
    Join Date
    Aug 2006
    Posts
    23
    Thanks for your help, not sure what u mean about calling, this is our work server I'm sure if they changed something they would let us know, can't I copy these missing libraries somewhere, or find where they are ?

  9. #9
    The superhaterodyne twomers's Avatar
    Join Date
    Dec 2005
    Location
    Ireland
    Posts
    2,273
    Is this the first program you have tried to make on it?

  10. #10
    Registered User
    Join Date
    Aug 2006
    Posts
    23
    No had a much larger program and received the same error, so then I wrote this simple sample and that didn't work either.....

  11. #11
    The superhaterodyne twomers's Avatar
    Join Date
    Dec 2005
    Location
    Ireland
    Posts
    2,273
    Have you tried making it simpler? without <string> ...

    Unfortunately I don't have a clue what could be wrong. Don't think taking out <string> would make any difference. Very odd though.

  12. #12
    Registered User
    Join Date
    Aug 2006
    Posts
    23
    yeah, i give up, i emailed the dba

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Avoiding Global variables
    By csonx_p in forum Windows Programming
    Replies: 32
    Last Post: 05-19-2008, 12:17 AM
  2. Makefile for a library
    By sirmoreno in forum Linux Programming
    Replies: 5
    Last Post: 06-04-2006, 04:52 AM
  3. Erros in Utility Header File
    By silk.odyssey in forum C++ Programming
    Replies: 4
    Last Post: 12-22-2003, 06:17 AM
  4. header file bringing errors?
    By bluehead in forum Windows Programming
    Replies: 4
    Last Post: 08-19-2003, 12:51 PM
  5. errors in my class....
    By o0obruceleeo0o in forum C++ Programming
    Replies: 9
    Last Post: 04-14-2003, 03:22 AM