Thread View: gnu.g++.help
2 messages
2 total messages
Started by Mr D. Vladicic
Wed, 09 Sep 1992 01:16
C++ construtor problem
Author: Mr D. Vladicic
Date: Wed, 09 Sep 1992 01:16
Date: Wed, 09 Sep 1992 01:16
44 lines
1684 bytes
1684 bytes
Iam a final year computer science student currently working on a
c++ project. The problem i have is that when i make my program
i get the following message
ld:
Undefined:
_$_4User
collect: /usr/bin/ld returned 1 exit status
*** Error code 1
i have linked the program to all its components e.g User
the program will compile except it wont give executable
permission to the final object code.
When i change mode the program will complete all its tasks
till it finishes at which point it gives a segmentation fault
WHAT I would like to KNOW is what causes the error is it the User constructor
or is it something else
example of the constructor is provided below
User::User(String& user_name,String& password)
{
person= new Personal; // simple struct
if (!Check_password(user_name, password))
{
cout<<" you bombed" << endl;
exit(1);
//give an error message and abort
}
Finances=new Financial(user_name);
History=new Tipping_History(user_name);
}
any assistance would be greatly appreciated
int401a@mdw045.cc.monash.edu.au
Dragan Vladicic
ld: Undefined symbol __$_9xxx
Author: Jonas Svanberg
Date: Sat, 12 Sep 1992 15:39
Date: Sat, 12 Sep 1992 15:39
31 lines
1731 bytes
1731 bytes
I believe I have the same problem as Mr D. Vladicic in his
contribution "C++ constructor problem"
I have a case when a static initialization of the form:
#include "Package.hh"
static Package* pac1 = new Package("pac 1");
will work but this:
static Package pac2("pac 2");
won`t work 'cause the linker complaines about __$_9Package
as an undefined symbol. I don't quite get it why the former
works and the latter won't. Both initializations are
swallowed by the compiler.
The class Package is separately compiled, but that shouldn't
affect the result, should it?
I use g++ 2.2 and am running on a Sun Sparc1.
I can do with the pointer initialization but it's irritating
nevertheless...
O----------------------------O----------------------------------O
| Jonas Svanberg | Email: svan@isy.liu.se |
| Div. of Information Theory O----------------------------------O
| Department of E.E. (ISY) | "And Noah said to the animals: |
| Linkoping University | - Go out and multiply! |
| S-581 83 Linkoping | The snake said: |
| SWEDEN | - But how can I? I'm an adder!" |
O----------------------------O----------------------------------O
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads