| |

VerySource

 Forgot password?
 Register
Search
View: 742|Reply: 4

About global variables

[Copy link]

5

Threads

23

Posts

12.00

Credits

Newbie

Rank: 1

Credits
12.00

 China

Post time: 2020-1-6 18:10:01
| Show all posts |Read mode
I define the global variable extern CString abc;
Why am I getting error C2071: 'abc': illegal storage class?
It's weird!
Reply

Use magic Report

0

Threads

4

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

Post time: 2020-1-7 01:36:01
| Show all posts
Extern means that the variable you want to define has been defined elsewhere, just declare it here.

Just remove extern.
Reply

Use magic Report

5

Threads

23

Posts

12.00

Credits

Newbie

Rank: 1

Credits
12.00

 China

 Author| Post time: 2020-1-11 15:09:02
| Show all posts
I want to create a new dialog through a button of the main dialog (two dialogs use different dialog classes), define a global variable in the main dialog ccp, such as CString str; declare extern in the new dialog cpp CString str ;, but in the main dialog box to assign a value to str, the new dialog box is still the initial value of str, has not changed, I am very confused! Ask prawn to help!
Reply

Use magic Report

0

Threads

57

Posts

27.00

Credits

Newbie

Rank: 1

Credits
27.00

 China

Post time: 2020-1-11 17:54:01
| Show all posts
How do you set this global variable?

If you just need to pass a string, add a public variable in the sub-dialog box. Assign it before DoModel.
Reply

Use magic Report

5

Threads

23

Posts

12.00

Credits

Newbie

Rank: 1

Credits
12.00

 China

 Author| Post time: 2020-1-17 09:18:01
| Show all posts
Thank you both!
I assigned the value after DoModel, so no!
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list