逐月之月 电视剧百度云:c++编译的时候总是出错是怎么回事啊?

来源:百度文库 编辑:高考问答 时间:2024/05/01 13:32:04
源程序:
#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
Debug/bianyiyuanli.exe : fatal error LNK1120: 1 unresolved externals
执行 link.exe 时出错.

bianyiyuanli.exe - 1 error(s), 0 warning(s)
一样的~

工程选项里是这样的~
kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /incremental:yes /pdb:"Debug/bianyiyuanli.pdb" /debug /machine:I386 /out:"Debug/bianyiyuanli.exe" /pdbtype:sept

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

或者改回去

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