简体   繁体   English

Visual Studio 2012 C ++错误

[英]visual studio 2012 c++ error

I just started to learn c++ and I wanted to show an arry in promt but i get this weird error 我刚开始学习c ++,我想在promt中显示arry,但出现这个奇怪的错误

this is my code: 这是我的代码:

#include "stdafx.h"
#include "conio.h"
#include <iostream>
using namespace std;

void _show(char a[10][10])
{
    int i,j;
    for(i=0;i<10;i++)
        for(j=0;j<10;j++)
            cout<<a[i][j];
}
void _main(int argc, _TCHAR* argv[])
{
    char a[10][10];
    int i,j;
    for(i=0;i<10;i++)
        for(j=0;j<10;j++)
            a[i][j]=0;
    _show(a);
}

and this is the error: 这是错误:

Error 1 error LNK2019: unresolved external symbol _main referenced in function 错误1错误LNK2019:函数中引用了未解析的外部符号_main

Error 2 error LNK1120: 1 unresolved externals 错误2错误LNK1120:1个未解决的外部

Your program is missing "main" function (which is used as entry point from OS). 您的程序缺少“主要”功能(用作OS的入口点)。 This function MUST have name: int main(int argc, char * argv[]) (for classic console based application) 此函数必须具有名称: int main(int argc, char * argv[]) (用于基于经典控制台的应用程序)

Don't use underscores here is an explanation why as they are reserved 不要使用下划线, 这是为什么保留它们的原因

main function should be declared as 主函数应声明为

int main(int argc, char *argv[])

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM