c++编译的时候总是出错是怎么回事啊?

来源:百度知道 编辑:UC知道 时间:2024/06/05 03:24:10
源程序:
#include <stdio.h>
#include <string.h>
#include <iostream.h>

void main()
{

char str[80], *word;

gets(str);
word = strtok(str, " ");
while(word != NULL) {

if(word[0] == '\'') printf("%s 是一个字符串\n\n", word);
}
}

这是提示信息:

--------------------Configuration: bianyiyuanli - Win32 Debug--------------------
Compiling...
bianyi.cpp
Linking...
LIBCD.lib(wincrt0.obj) : error LNK2001: unresolved external symbol _WinMain@16
Debug/bianyiyuanli.exe : fatal error LNK1120: 1 unresolved externals
执行 link.exe 时出错.

bianyiyuanli.exe - 1 error(s), 0 warning(s)
还是不行啊~
--------------------Configuration: bianyiyuanli - Win32 Debug--------------------
Compiling...
bianyi.cpp
Linking...
LIBCD.lib(wincrt0.obj) : error LNK2001: unresolved external symbol _WinMain@16
D

[Project] --> [Settings] --> 选择"Link"属性页,
在Project Options中将/subsystem:console改成/subsystem:windows

或者改回去

#include <string.h>
这个是不对的,应该为
#include "string"
using namespace std;