| |

VerySource

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

Is XXView.h added with #include "XXDoc.h"?

[Copy link]

1

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-2-5 13:30:02
| Show all posts |Read mode
Compile error: ChanoiDoc * GetDocument (); line

error C2143: syntax error: missing ';' before '*'
error C2501: 'CHanoiDoc': missing storage-class or type specifiers
error C2501: 'GetDocument': missing storage-class or type specifiers

Only by adding #include "HanoiDoc.h" to compile, it can be used in other projects. So I think it is wrong elsewhere, but I don't know where it is wrong, I hope to give pointers.
Reply

Use magic Report

0

Threads

36

Posts

22.00

Credits

Newbie

Rank: 1

Credits
22.00

 China

Post time: 2020-4-17 12:00:01
| Show all posts
correct.
If you do not want to add header files, you can change to
class CHanoiDoc * GetDocument ();
Reply

Use magic Report

0

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-4-19 11:45:01
| Show all posts
You visited the members of the view in MainFrame.
Reply

Use magic Report

0

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-4-22 12:45:01
| Show all posts
Add a sentence at the beginning of the file
class CHanoiDoc;
See if it works
Reply

Use magic Report

1

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 Indonesia

 Author| Post time: 2020-7-22 16:00:01
| Show all posts
Reply tozippodiy
    Yes, I later discovered that this problem occurs as long as #include "XXView.h" in other classes.
I find it strange that if other classes are used in header files for general classes, the corresponding header files must be included in their header files. If they are included in their cpp, the compiler will not "recognize" them. Why can the View class
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