帮忙看看一段代码,想调试看看this指针
时间:2011-11-25
来源:互联网
class screen
{
public:
typedef std::string::size_type index;
private:
std::string contents;
index cursor;
index height,width;
public:
screen &move(index r,index c);
screen &set(char);
screen &set(index,index,char);
};
screen &screen::set(char c)
{
contents[cursor] = c;
return *this;
}
screen &screen::move(index r,index c)
{
index row=r*width;
cursor =row+c;
return *this;
}
-------------------------------------------------------------------------
IBCD.lib(crt0.obj) : error LNK2019: 无法解析的外部符号 _main ,该符号在函数 _mainCRTStartup 中被引用
Debug/aa.exe : fatal error LNK1120: 1 个无法解析的外部命令
作者: caixucxcxforever 发布时间: 2011-11-25
入口呢?
作者: lgstudyvc 发布时间: 2011-11-25
要么你是Window程序但是设置system => subsystem =>Console (/SUBSYSTEM:CONSOLE)函数?
作者: yuucyf 发布时间: 2011-11-25
建立的是控制台程序,需要main函数的 改为 #include <iostream> class screen { public: typedef std::string::size_type index; private: std::string contents; index cursor; index height,width; public: screen &move(index r,index c); screen &set(char); screen &set(index,index,char); }; screen &screen::set(char c) { contents[cursor] = c; return *this; } screen &screen::move(index r,index c) { index row=r*width; cursor =row+c; return *this; } //增加main函数 int main(void) { screen sc; ....其他 return 0; }
作者: gameslq 发布时间: 2011-11-25
作者: VisualEleven 发布时间: 2011-11-25
要么你是没有main函数?
要么你是Window程序但是设置system => subsystem =>Console (/SUBSYSTEM:CONSOLE)函数?
main 函数是必须的吗?
我看过一些 根本不用main函数都能调试通过啊。。。。
我只是想看看this指针 里面的值 到底是多少。。。
作者: caixucxcxforever 发布时间: 2011-11-25
C/C++ code
建立的是控制台程序,需要main函数的
改为
#include <iostream>
class screen
{
public:
typedef std::string::size_type index;
private:
std::string contents;
index cursor;
index height,width;
public:
scree……
main 函数是必须的吗? 加上main 函数确实调试过了
作者: caixucxcxforever 发布时间: 2011-11-25
引用 2 楼 yuucyf 的回复:
要么你是没有main函数?
要么你是Window程序但是设置system => subsystem =>Console (/SUBSYSTEM:CONSOLE)函数?
main 函数是必须的吗?
我看过一些 根本不用main函数都能调试通过啊。。。。
我只是想看看this指针 里面的值 到底是多少。。。
控制台程序当然要有main函数啦。
作者: yuucyf 发布时间: 2011-11-25
引用 3 楼 gameslq 的回复:
C/C++ code
建立的是控制台程序,需要main函数的
改为
#include <iostream>
class screen
{
public:
typedef std::string::size_type index;
private:
std::string contents;
index cursor;
ind……
哪些地方用main函数 哪些地方可以不用main函数???请将
作者: caixucxcxforever 发布时间: 2011-11-25
main和winmain,UNICODE下和多字节下名字稍有不同,MFC里winmain被封装了,其实还是有调用到的
作者: dahaiI0 发布时间: 2011-11-25
============
C++/C语言程序一般情况下一定要用入口函数,对于控制台程序入口函数是main,对于窗口应用程序是WinMain函数。
其实确实也有不用main函数的情况。入口点函数只是编译器设置的一个规定,程序总得有一个开始执行的位置。比如你不写main函数,直接定义一个mainCRTStartup函数也是可以的。
作者: wltg2001 发布时间: 2011-11-25
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28