Baffling undefined symbol

N

Neo

Hi,
I have a class structure like this-
//foo.h
class foo {
class_a *ac;
class_b *bc;
---
---
};

I am compiling the above class and its subclasses as a library and
statically linking it at compile time.
Now I have this -
//network.cpp
#include "foo_init.h"
network::network() {
---
init_foo();
}

network::init_foo() {
my foo = new foo(); ***
---
}
where
//foo_init.h
#include foo.h
foo* my_foo;
---
read();
write();
---

I have path to library and source files all set but when I compile the
above setup I get undefined symbol for *** call even though I am
linking that library. What could be wrong?


Thanks,
Neo
 
N

Neo

foo *my_foo = new foo();

The declaration for function init_foo() should also be causing a compile
error, since no return type is provided.
-Howard

There is a small typo in my earlier post as I didn't put everything.
It compiles fine but fails while linking with the undef symbol on that
line where I say my_foo = new foo(). Here my_foo is in global scope
(declared in the foo_init.h)and points to an object of type foo.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,266
Latest member
DavidaAlla

Latest Threads

Top