[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

g++ linker error



Hi!

I just installed Debian 2.1 and tried tu compile a small program with the
g++ compiler. It worked. then I tried to write a Header file and a CPP file
and compile it, so I could use the methods in there in other programs. Just
to test, if it would work. Here are the files:

HEADER:
struct Test {
   void func();
};

CPP:
#include "test.h"
#include <iostream>
using namespace std;
void Test::func() {
   cout << "This function does absolutely nothing!\n";
}


Thats all.
As I said    g++ test.cpp
my compiler returned:
/usr/lib/crt1.o(.text+0x36): undefined reference to 'main'
collect2: ld returned 1 exit status


What went wrong??? HELP!!!

-- 
Sent through Global Message Exchange - http://www.gmx.net


Reply to: