Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #6221

Strange linker problem

Path csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!border4.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!novia!news-out.readnews.com!news-xxxfer.readnews.com!panix!not-for-mail
From Ruben Safir <ruben@mrbrklyn.com>
Newsgroups comp.lang.c++
Subject Strange linker problem
Date Sun, 5 Jun 2011 01:33:56 +0000 (UTC)
Organization PANIX Public Access Internet and UNIX, NYC
Lines 136
Message-ID <iseme4$qse$1@reader1.panix.com> (permalink)
NNTP-Posting-Host www2.mrbrklyn.com
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding 8bit
X-Trace reader1.panix.com 1307237636 27534 96.57.23.82 (5 Jun 2011 01:33:56 GMT)
X-Complaints-To abuse@panix.com
NNTP-Posting-Date Sun, 5 Jun 2011 01:33:56 +0000 (UTC)
X-Blackjet Blackjet is a Yankee Fan
X-DRMisTHEFT Use GNU Linux today
X-From A Dark Cloud
X-LOCATION Brooklyn NY - Forget abou' it!
X-NYLXS Really - yah think computers are supposed to be broken?
User-Agent Pan/0.133 (House of Butterflies)
Xref x330-a1.tempe.blueboxinc.net comp.lang.c++:6221

Show key headers only | View raw


I have a newish workstation on an operton64 system with a fresh opensuse 
11.4 x86 64 bit install.

I'm trying to compile a program that I started, nothing special, that 
uses iostream but I'm getting this linker error

ruben@stat18:~/cplus> make
g++ -Wall -o quiz quiz.o 
quiz.o: In function `std::basic_ios<char, std::char_traits<char> 
>::basic_ios(std::basic_ios<char, std::char_traits<char> > const&)':
quiz.cpp:(.text._ZNSt9basic_iosIcSt11char_traitsIcEEC2ERKS2_
[_ZNSt9basic_iosIcSt11char_traitsIcEEC5ERKS2_]+0x1f): undefined reference 
to `std::ios_base::ios_base(std::ios_base const&)'
collect2: ld returned 1 exit status
make: *** [quiz] Error 1


It compiles fine on my other workstation

#include <iostream>
#include "questions.h"
#include <string>
#include <vector>

  int main(int argv, char *argc[]){
    Questions::menu();
  
  
  
    return 0;
}


questions.h

#ifndef QUESTION
#define QUESTION
#include <cstdlib>
#include <string>
#include <vector>
#include <iostream>
#include <iomanip>

namespace Questions {

class Question{

  public:
    Question(std::string q, std::string a): quest(q), answer(a){ }



  private:
    std::string quest;
    std::string response;
    std::string answer;
    Question(Question const &copy);



};

class Deck{

  public:
    std::vector<Question> deck;
    Deck(){
      std::string home = std::getenv("HOME");
      database = home + "/quiz.db";
      size = 0;
    }



    void get_stack();
    Question get_question();
    void give_quiz();
    void add_questions(Question &enter);
    void add_database();
 
  private:
    int size;
    std::string database;

};

void menu(std::ostream &os = std::cout);

void menu(std::ostream &os){

  os << "Welcome the the C++ Quiz" << "\n\n\n\n" << std::endl;
  std::string tmp = " \n "
  "Select from one of the following: \n\n"
"a) Insert Question and Answer into the database\n"
"b) Read 25 Questions and run Quiz\n\n\nResponse==> ";
  
  os << tmp << std::endl;

}
  

} //end of namespace Question
#endif

Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib64/gcc/x86_64-suse-linux/4.5/lto-wrapper
Target: x86_64-suse-linux
Configured with: ../configure --prefix=/usr --infodir=/usr/share/info --
mandir=/usr/share/man --libdir=/usr/lib64 --libexecdir=/usr/lib64 --
enable-languages=c,c++,objc,fortran,obj-c++,java,ada --enable-
checking=release --with-gxx-include-dir=/usr/include/c++/4.5 --enable-ssp 
--disable-libssp --disable-plugin --with-bugurl=http://bugs.opensuse.org/ 
--with-pkgversion='SUSE Linux' --disable-libgcj --disable-libmudflap --
with-slibdir=/lib64 --with-system-zlib --enable-__cxa_atexit --enable-
libstdcxx-allocator=new --disable-libstdcxx-pch --enable-version-specific-
runtime-libs --program-suffix=-4.5 --enable-linux-futex --without-system-
libunwind --enable-gold --with-plugin-ld=/usr/bin/gold --with-
arch-32=i586 --with-tune=generic --build=x86_64-suse-linux
Thread model: posix
gcc version 4.5.1 20101208 [gcc-4_5-branch revision 167585] (SUSE Linux) 


This is the makefile


quiz : quiz.o
           g++ -Wall -o quiz quiz.o 

quiz.o :        quiz.cpp
        g++ -Wall -c quiz.cpp   


I'm not certain why it can't find the iostream copy constructor.

Ruben

Back to comp.lang.c++ | Previous | Next | Find similar | Unroll thread


Thread

Strange linker problem Ruben Safir <ruben@mrbrklyn.com> - 2011-06-05 01:33 +0000

csiph-web