problem with static char

Y

yang__lee

Hi,

I am facing a problem .

In VS 2006 I have created a win32 static library.

in one of the functions I have declared a variable as

static char path[1000]="\0";

I link this library to another exe.

WHile debugging when control comes on this declaration,

it doesn't identify path.

I tried to copy "path" to watch window but it says symbol not found.

Why is that so.

My OS is windows XP . is it that .net 2005 that was instaleld.

Kindly let me know.

regards

Vijay
 
R

Ron Natalie

Hi,

I am facing a problem .

In VS 2006 I have created a win32 static library.

in one of the functions I have declared a variable as

static char path[1000]="\0";

I link this library to another exe.

WHile debugging when control comes on this declaration,
You're probably not in a function where path is in the scope.
The static storage class specifier implies internal linkage.
Contexts outside of that file can't see it.
 
R

Ron Natalie

Hi,

I am facing a problem .

In VS 2006 I have created a win32 static library.

in one of the functions I have declared a variable as

static char path[1000]="\0";
The above construct is deprecated. Put the variable in a
(possibly unnamed) namespace.
 
V

Victor Bazarov

Ron said:
Hi,

I am facing a problem .

In VS 2006 I have created a win32 static library.

in one of the functions I have declared a variable as

static char path[1000]="\0";
The above construct is deprecated. Put the variable in a
(possibly unnamed) namespace.

Twice you posted and it seems twice you missed the fact that
the OP said "in one of the functions ...". The 'path' does
*not* have namespace scope.

The OP's problem is with VC++ debugger, which doesn't have
the ability to identify static local variables.

V
 
V

Victor Bazarov

Hi,

I am facing a problem .

In VS 2006 I have created a win32 static library.

What's VS 2006? Do you mean Visual C++ v6?
in one of the functions I have declared a variable as

static char path[1000]="\0";

I link this library to another exe.

WHile debugging when control comes on this declaration,

it doesn't identify path.

I tried to copy "path" to watch window but it says symbol not found.

Why is that so.

Because VC++ debugger is buggy, most likely.
My OS is windows XP . is it that .net 2005 that was instaleld.
Huh?

Kindly let me know.

The solution is relatively simple. Add another variable

const char (&rpath)[1000] = path;

(right after your 'path'), and use that variable to examine the
contents of the array in the debugger.

V
 

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

Forum statistics

Threads
473,756
Messages
2,569,540
Members
45,025
Latest member
KetoRushACVFitness

Latest Threads

Top