Thank you for being a valued part of the CNET community. As of December 1, 2020, the forums are in read-only format. In early 2021, CNET Forums will no longer be available. We are grateful for the participation and advice you have provided to one another over the years.

Thanks,

CNET Support

General discussion

relocation error

Nov 13, 2005 9:44PM PST

hi,
in a C program i hav defined a global variable whose sole purpose is to check a thread, ie. in the thread's function i check the variable's value to continue with the function or to abort. when i compile n use the exe in some other machine it gives me a reloaction error stating "undefined symbol". but if i declare that variable as static everything seems to work fine.wht cld possibly b the problem.
all leads to the solution will b appreciated full heartedly..Happy
tahnks
-Manoj

Discussion is locked

- Collapse -
if i declare that variable as static everything seems to
Nov 13, 2005 11:25PM PST

" if i declare that variable as static everything seems to work fine "

You've fixed the issue. This is more a 'c' issue and with too many fine books and classes on c than we can imagine you only need to hit the books again.

Bob

- Collapse -
Thanx
Nov 14, 2005 10:24PM PST

correct i hav solved the issue but still can't figure out the base cuase...cause only thing that i can see is declaring it as static restricts the scope of the variable to the file only but as there are no cross refrencing in other files adn also there are other global variables in the same c file and used in d similar fashion but they work abs fine....

- Collapse -
Let me put it another way.
Nov 14, 2005 10:38PM PST

Ever read or hear of the story of 3 blind men and the elephant? I'm one of them seeing only what you revealed of your code. Or if I brought you only this much code would you tell me what's wrong?

Again, it's a simple C issue, you solved your issue so it's time to keep coding and learning.

Bob