My first CXX problem:"aggregate has incomplete type and cannot be defined"
来源:互联网 发布:知彼网络 编辑:程序博客网 时间:2024/06/04 19:51
When I test to code in CPP, I meet a problem. And It's error:aggregate ‘Printer My_Printer’ has incomplete type and cannot be defined.
After my debug I realized that there is an error in my statement in class. I statement my class in hello.cc file is fault, And when I move the statement into hello.h file the error is disappear.
hello.cc
hello.h
main.cc
main.h
makefile
After my debug I realized that there is an error in my statement in class. I statement my class in hello.cc file is fault, And when I move the statement into hello.h file the error is disappear.
hello.cc
点击(此处)折叠或打开
- /***************************
- *filename:hello.cc
- *filedescription:test
- *writer:warrior
- *date:2015/4/5
- *mail:675979646@qq.com
- **************************/
- //include
- #include "hello.h"
- using namespace std;
- //define
- //variable
- //class
- //function
- /*********************
- *function name:void hello()
- *function discription:
- *parameter:
- input: NULL
- output: NULL
- ********************/
- void Printer::Hello()
- {
- char name[10];
- cout<<"Please input your name :"<<endl;
- cin>>name;
- cout<<"Hello C++!"<<endl;
- cout<<"I am "<<name<<" ."<<endl;
- };
hello.h
点击(此处)折叠或打开
- #ifndef _HELLO_H_
- #define _HELLO_H_
- //include
- #include <iostream>
- #include <sstream>
- class Printer
- {
- private:
- int Serial_Number;
- public:
- void Hello();
- };
- #endif
main.cc
点击(此处)折叠或打开
- /***************************
- *filename:main.cc
- *filedescription:test
- *writer:warrior
- *date:2015/4/5
- *mail:675979646@qq.com
- **************************/
- //include
- #include "main.h"
- using namespace std;
- //define
- //variable
- //function
- /*********************
- *function name:int main()
- *function discription:the main function
- *parameter:
- input: NULL
- output: NULL
- ********************/
- int main()
- {
- Printer My_Printer;
- My_Printer.Hello();
- return 0;
- }
main.h
点击(此处)折叠或打开
- #ifndef _MAIN_H_
- #define _MAIN_H_
- #include <stdio.h>
- #include "hello.h"
- #endif
makefile
点击(此处)折叠或打开
- #makefile demo V1.0
- #author: warrior
- #mail:675979646@qq.com
- #date:2015/4/5
- CXX := g++
- CFLAGS := -c -g -W -Wall
- DIR := ./
- SOURCES := $(shell ls *.cc)
- OBJS := $(patsubst %.cc,%.o,$(SOURCES))
- TARGET := target
- ${TARGET} : ${OBJS}
- ${CXX} -o $@ $^
- %.o : %.cc
- $(CXX) ${CFLAGS} -o $@ $<
- .PHONY : clean
- clean :
- -rm -f *.o target
0
上一篇:My understand of KMP describe in C
下一篇:define function pointer
相关热门文章
- test123
- 编写安全代码——小心有符号数...
- 使用openssl api进行加密解密...
- 一段自己打印自己的c程序...
- sql relay的c++接口
- linux dhcp peizhi roc
- 关于Unix文件的软链接
- 求教这个命令什么意思,我是新...
- sed -e "/grep/d" 是什么意思...
- 谁能够帮我解决LINUX 2.6 10...
给主人留下些什么吧!~~
评论热议
0 0
- My first CXX problem:"aggregate has incomplete type and cannot be defined"
- c++ aggregate 'std::stringstream ss' has incomplete type and cannot be defined
- 解决 has incomplete type
- field has incomplete type
- error: field ‘?’ has incomplete type
- array element has incomplete type
- error: field * has incomplete type
- error: array type has incomplete element type
- Debug : array type has incomplete element type
- variable `xxx' has initializer but incomplete type
- variable `xxx' has initializer but incomplete type
- [C++编译]field has incomplete type
- variable `xxx' has initializer but incomplete type
- QT编译出错 field has incomplete type
- variable "xxx" has initializer but incomplete type
- 编译报错"field has incomplete type"
- The final local variable xxx cannot be assigned, since it is defined in an enclosing type
- The final local variable xxx cannot be assigned, since it is defined in an enclosing type
- build makefile for my coding!!
- My understand of "iptables"
- shell 编程语法总结(I/O 逻辑控制结构)
- My understand of stack and queue
- My understand of KMP describe in C
- My first CXX problem:"aggregate has incomplete type and cannot be defined"
- define function pointer
- notes of C++
- My start of git
- 对搜索引擎的初了解发展及核心框架
- 搜索引擎之网络爬虫
- my makefile for CPP v2.0
- 常见ddl无刷联动效果
- JAVA 中 extends 与 implements 的前世今生
原创粉丝点击
热门IT博客
热门问题
老师的惩罚
人脸识别
我在镇武司摸鱼那些年
重生之率土为王
我在大康的咸鱼生活
盘龙之生命进化
天生仙种
凡人之先天五行
春回大明朝
姑娘不必设防,我是瞎子
井上织姬的梗
井上正大神牙
黑崎一护和井上结婚
农家小日子 雨前井上
不良农女之盛世田园 井上一醉
井中月
君临天下井中月破解版下载
双井修电脑
井伊直虎
古井伊织全集在线播放
井的部首
井字部首是什么字
井组词语
井偏旁
井的偏旁
井的部首是什么偏旁
井的偏旁部首
井冈山在哪里
井冈山大学
井冈山哪个省
井冈山在哪个省
井冈山旅游攻略
重上井冈山
井冈山斗争
江西井冈山
井冈山公棚
井冈山根据地
井冈山市
井冈山的斗争
井冈山门票
井冈山景点
井冈山特产
水调歌头井冈山
井冈山斗争时期
重上井冈山诗词
井冈山图片
井冈山在哪
井冈山精神是什么
井冈山机场
念奴娇井冈山
井冈山诗词