Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

关于7_32.h编译不通过的问题。 #2

Open
beibei12345 opened this issue Mar 21, 2023 · 0 comments
Open

关于7_32.h编译不通过的问题。 #2

beibei12345 opened this issue Mar 21, 2023 · 0 comments

Comments

@beibei12345
Copy link

beibei12345 commented Mar 21, 2023

你好,我测试你代码的时候,有一个头文件7_32.h一直编译不通过,我换了两个编译器都不行,下面是一些错误信息,请你看一下有没有解决方案?谢谢。

我的操作系统是:
版本 Windows 10 专业工作站版
版本号 22H2
安装日期 ‎2023/‎2/‎20
操作系统内部版本 19045.2604
体验 Windows Feature Experience Pack 120.2212.4190.0
64位

----在vs 2022中报以下错误:
`Build started...
1>------ Build started: Project: Project2, Configuration: Debug x64 ------

1>main.cpp
1>C:\Users\Administrator\source\repos\primer5\chapter7\Project2\Project2\7_32.h(15,40): error C2027: use of undefined type 'Screen'
1>C:\Users\Administrator\source\repos\primer5\chapter7\Project2\Project2\7_32.h(7,7): message : see declaration of 'Screen'
1>C:\Users\Administrator\source\repos\primer5\chapter7\Project2\Project2\7_32.h(21,6): error C2027: use of undefined type 'Screen'
1>C:\Users\Administrator\source\repos\primer5\chapter7\Project2\Project2\7_32.h(7,7): message : see declaration of 'Screen'
1>C:\Users\Administrator\source\repos\primer5\chapter7\Project2\Project2\7_32.h(21,31): error C2027: use of undefined type 'Screen'
1>C:\Users\Administrator\source\repos\primer5\chapter7\Project2\Project2\7_32.h(7,7): message : see declaration of 'Screen'
1>C:\Users\Administrator\source\repos\primer5\chapter7\Project2\Project2\7_32.h(21,42): error C2027: use of undefined type 'Screen'
1>C:\Users\Administrator\source\repos\primer5\chapter7\Project2\Project2\7_32.h(7,7): message : see declaration of 'Screen'
1>C:\Users\Administrator\source\repos\primer5\chapter7\Project2\Project2\7_32.h(21,29): error C2440: '': cannot convert from 'char' to 'std::string'
1>C:\Users\Administrator\source\repos\primer5\chapter7\Project2\Project2\7_32.h(21,29): message : No constructor could take the source type, or constructor overload resolution was ambiguous
1>Done building project "Project2.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
========== Build started at 10:50 AM and took 01.120 seconds ==========`

-----在Clion中报以下错误:
注:Clion使用的标准是C11,项目名是untitled2,编译器配置如下:
图片
`====================[ Build | untitled2 | Debug ]===============================

"C:\Program Files\JetBrains\CLion 2022.3.3\bin\cmake\win\x64\bin\cmake.exe" --build C:\Users\Administrator\CLionProjects\untitled2\cmake-build-debug --target untitled2 -j 12
[1/2] Building CXX object CMakeFiles/untitled2.dir/main.cpp.obj
FAILED: CMakeFiles/untitled2.dir/main.cpp.obj
C:\PROGRA1\JETBRA1\CLION2~1.3\bin\mingw\bin\G__~1.EXE -g -fdiagnostics-color=always -std=gnu++11 -MD -MT CMakeFiles/untitled2.dir/main.cpp.obj -MF CMakeFiles\untitled2.dir\main.cpp.obj.d -o CMakeFiles/untitled2.dir/main.cpp.obj -c C:/Users/Administrator/CLionProjects/untitled2/main.cpp
In file included from C:/Users/Administrator/CLionProjects/untitled2/main.cpp:2:
C:/Users/Administrator/CLionProjects/untitled2/7_32.h:15:51: error: invalid use of incomplete type 'class Screen'
15 | std::vector screens{Screen(24, 80, ' ')};
| ^
C:/Users/Administrator/CLionProjects/untitled2/7_32.h:7:7: note: forward declaration of 'class Screen'
7 | class Screen;
| ^~~~~~
C:/Users/Administrator/CLionProjects/untitled2/7_32.h:15:52: error: could not convert '{}' from '' to 'std::vector'
15 | std::vector screens{Screen(24, 80, ' ')};
| ^
| |
|
C:/Users/Administrator/CLionProjects/untitled2/7_32.h: In member function 'void Window_mng::clear(Window_mng::ScreenIndex)':
C:/Users/Administrator/CLionProjects/untitled2/7_32.h:21:5: error: invalid use of incomplete type 'class Screen'
21 | s.contents = std::string(s.height * s.width, ' ');
| ^
C:/Users/Administrator/CLionProjects/untitled2/7_32.h:7:7: note: forward declaration of 'class Screen'
7 | class Screen;
| ^~~~~~
C:/Users/Administrator/CLionProjects/untitled2/7_32.h:21:30: error: invalid use of incomplete type 'class Screen'
21 | s.contents = std::string(s.height * s.width, ' ');
| ^
C:/Users/Administrator/CLionProjects/untitled2/7_32.h:7:7: note: forward declaration of 'class Screen'
7 | class Screen;
| ^~~~~~
C:/Users/Administrator/CLionProjects/untitled2/7_32.h:21:41: error: invalid use of incomplete type 'class Screen'
21 | s.contents = std::string(s.height * s.width, ' ');
| ^
C:/Users/Administrator/CLionProjects/untitled2/7_32.h:7:7: note: forward declaration of 'class Screen'
7 | class Screen;
| ^~~~~~
ninja: build stopped: subcommand failed.
`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant