It's been a few years since I have programmed in C++. I'm starting
to develop some programs in C++ and I can't get "Hello, World" working
yet. It looks to me like 'cout' in the std library is not being found, even
though I have it installed on the system.
I'm using gcc version 3.4.6 and I have libstdc++5 and libstdc++6 installed.
my program looks like this:
// Builder.cc
#include "Builder.h"
Builder::Builder() {
// cout << "Builder constructor\n" ;
}
// Builder.h
#ifndef BUILDER_H
#define BUILDER_H
#endif
class Builder {
public:
Builder();
};
// test.cc
#include <iostream>
using namespace std;
#include "Builder.h"
main() {
Builder b = Builder();
cout << "Hello\n";
}
# makefile
Builder.o: Builder.cc
gcc -c Builder.cc
test.o: test.cc
gcc -c test.cc
test: test.o Builder.o
gcc -o test Builder.o test.o
clean:
rm -rf *.o test
When I compile and link, I get the following linking error message:
gcc -c test.cc
gcc -c Builder.cc
gcc -o test Builder.o test.o
test.o: In function `std::__verify_grouping(char const*, unsigned int, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':test.cc

:test.cc


:test.cc


:test.cc


test.o: In function `main':test.cc

:test.cc


test.o: In function `__static_initialization_and_destruction_0(int, int)':test.cc

test.o: In function `__tcf_0':test.cc

test.o

collect2: ld returned 1 exit status
make: *** [test] Error 1
Does anyone have any suggestions on how to fix my problem? Thank
you in advance!!
Jim Anderson
Comment