在微软学生中心下的visual studio 2008 Professional,申请product Key安装成功都没问题,可是启动后无论编译什么程序都报错,就连个简单的Hello World,都编译出一百多个错误,这是怎么回事,是我的设置有问题么? 我的系统是Vista Ultimate 32位,
1>------ 已启动生成: 项目: win32app, 配置: Debug Win32 ------
1>正在编译...
1>win32Helloworld.cpp
1>e:\users\administrator\documents\visual studio 2008\projects\win32app\win32app\win32helloworld.cpp(1) : error C2146: 语法错误 : 缺少“;”(在标识符“WinMain”的前面)
1>e:\users\administrator\documents\visual studio 2008\projects\win32app\win32app\win32helloworld.cpp(1) : error C2065: “HINSTANCE”: 未声明的标识符
1>e:\users\administrator\documents\visual studio 2008\projects\win32app\win32app\win32helloworld.cpp(1) : error C2146: 语法错误 : 缺少“)”(在标识符“hInstance”的前面)
1>e:\users\administrator\documents\visual studio 2008\projects\win32app\win32app\win32helloworld.cpp(1) : error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int
1>e:\users\administrator\documents\visual studio 2008\projects\win32app\win32app\win32helloworld.cpp(4) : error C2059: 语法错误 : “)”
1>e:\users\administrator\documents\visual studio 2008\projects\win32app\win32app\win32helloworld.cpp(5) : error C2143: 语法错误 : 缺少“;”(在“{”的前面)
1>e:\users\administrator\documents\visual studio 2008\projects\win32app\win32app\win32helloworld.cpp(5) : error C2447: “{”: 缺少函数标题(是否是老式的形式表?)
1>e:\users\administrator\documents\visual studio 2008\projects\win32app\win32app\win32helloworld.cpp(77) : error C2146: 语法错误 : 缺少“;”(在标识符“CALLBACK”的前面)
1>e:\users\administrator\documents\visual studio 2008\projects\win32app\win32app\win32helloworld.cpp(77) : error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int
1>e:\users\administrator\documents\visual studio 2008\projects\win32app\win32app\win32helloworld.cpp(77) : error C2146: 语法错误 : 缺少“;”(在标识符“WndProc”的前面)
1>e:\users\administrator\documents\visual studio 2008\projects\win32app\win32app\win32helloworld.cpp(77) : error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int
1>e:\users\administrator\documents\visual studio 2008\projects\win32app\win32app\win32helloworld.cpp(77) : error C2065: “HWND”: 未声明的标识符
1>e:\users\administrator\documents\visual studio 2008\projects\win32app\win32app\win32helloworld.cpp(77) : error C2065: “UINT”: 未声明的标识符
1>e:\users\administrator\documents\visual studio 2008\projects\win32app\win32app\win32helloworld.cpp(77) : error C2065: “WPARAM”: 未声明的标识符
1>e:\users\administrator\documents\visual studio 2008\projects\win32app\win32app\win32helloworld.cpp(77) : error C2065: “LPARAM”: 未声明的标识符
1>e:\users\administrator\documents\visual studio 2008\projects\win32app\win32app\win32helloworld.cpp(78) : error C2448: “WndProc”: 函数样式初始值设定项类似函数定义
1>生成日志保存在“file://e:\Users\Administrator\Documents\Visual Studio 2008\Projects\win32app\win32app\Debug\BuildLog.htm”
1>------ 已启动生成: 项目: win32app, 配置: Debug Win32 ------
1>正在编译...
1>win32Helloworld.cpp
1>e:\users\administrator\documents\visual studio 2008\projects\win32app\win32app\win32helloworld.cpp(1) : error C2146: 语法错误 : 缺少“;”(在标识符“WinMain”的前面)
1>e:\users\administrator\documents\visual studio 2008\projects\win32app\win32app\win32helloworld.cpp(1) : error C2065: “HINSTANCE”: 未声明的标识符
1>e:\users\administrator\documents\visual studio 2008\projects\win32app\win32app\win32helloworld.cpp(1) : error C2146: 语法错误 : 缺少“)”(在标识符“hInstance”的前面)
1>e:\users\administrator\documents\visual studio 2008\projects\win32app\win32app\win32helloworld.cpp(1) : error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int
1>e:\users\administrator\documents\visual studio 2008\projects\win32app\win32app\win32helloworld.cpp(4) : error C2059: 语法错误 : “)”
1>e:\users\administrator\documents\visual studio 2008\projects\win32app\win32app\win32helloworld.cpp(5) : error C2143: 语法错误 : 缺少“;”(在“{”的前面)
1>e:\users\administrator\documents\visual studio 2008\projects\win32app\win32app\win32helloworld.cpp(5) : error C2447: “{”: 缺少函数标题(是否是老式的形式表?)
1>e:\users\administrator\documents\visual studio 2008\projects\win32app\win32app\win32helloworld.cpp(77) : error C2146: 语法错误 : 缺少“;”(在标识符“CALLBACK”的前面)
1>e:\users\administrator\documents\visual studio 2008\projects\win32app\win32app\win32helloworld.cpp(77) : error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int
1>e:\users\administrator\documents\visual studio 2008\projects\win32app\win32app\win32helloworld.cpp(77) : error C2146: 语法错误 : 缺少“;”(在标识符“WndProc”的前面)
1>e:\users\administrator\documents\visual studio 2008\projects\win32app\win32app\win32helloworld.cpp(77) : error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int
1>e:\users\administrator\documents\visual studio 2008\projects\win32app\win32app\win32helloworld.cpp(77) : error C2065: “HWND”: 未声明的标识符
1>e:\users\administrator\documents\visual studio 2008\projects\win32app\win32app\win32helloworld.cpp(77) : error C2065: “UINT”: 未声明的标识符
1>e:\users\administrator\documents\visual studio 2008\projects\win32app\win32app\win32helloworld.cpp(77) : error C2065: “WPARAM”: 未声明的标识符
1>e:\users\administrator\documents\visual studio 2008\projects\win32app\win32app\win32helloworld.cpp(77) : error C2065: “LPARAM”: 未声明的标识符
1>e:\users\administrator\documents\visual studio 2008\projects\win32app\win32app\win32helloworld.cpp(78) : error C2448: “WndProc”: 函数样式初始值设定项类似函数定义
1>生成日志保存在“file://e:\Users\Administrator\Documents\Visual Studio 2008\Projects\win32app\win32app\Debug\BuildLog.htm”
解决方案 »
- 郁闷了,一个简单问题 combo box 获得一行字符串
- SourceForge的文件怎么下不下来啊?
- 删除文件时,会触发什么消息??
- 请问谁有 VC++ SERVICE PACK 3 的升级包啊?
- 怎么在MFC中用OpenGL实现用鼠标拖动一个物体,以便从不同角度观察此物体?
- 有没有办法查看*.lib中的函数???? 请赐教???
- MFC中的链表?
- 我需要微软最新的Platform SDK Release: August 2002 ,请问哪儿能够下载?
- 大伙帮我看看一个用组件服务注册com组件时,在事件查看器中描述的错误。
- mfc单文档程序嵌入对话框尺寸确定问题(vs10)
- 2008中国软件技术英雄会(上海站)有多少人收到CSDN邀请函的?
- 怎么从CDDB获取CD的信息呢?
包含windows.h这个头文件
用向导生成个基于对话框的程序,向导结束处报错:error RC2104:undefined keyword or key name:DS_SHELLFONT
快疯了,花了两三天下载,重装了两遍,问题依旧
#include <windows.h>
int WINAPI WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
WNDCLASSEX wcex; wcex.cbSize = sizeof(WNDCLASSEX);
wcex.style = CS_HREDRAW | CS_VREDRAW;
wcex.lpfnWndProc = WndProc;
wcex.cbClsExtra = 0;
wcex.cbWndExtra = 0;
wcex.hInstance = hInstance;
wcex.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_APPLICATION));
wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
wcex.lpszMenuName = NULL;
wcex.lpszClassName = szWindowClass;
wcex.hIconSm = LoadIcon(wcex.hInstance, MAKEINTRESOURCE(IDI_APPLICATION));
if (!RegisterClassEx(&wcex))
{
MessageBox(NULL,
_T("Call to RegisterClassEx failed!"),
_T("Win32 Guided Tour"),
NULL); return 1;
}
static TCHAR szWindowClass[] = _T("win32app");
static TCHAR szTitle[] = _T("Win32 Guided Tour Application");
// The parameters to CreateWindow explained:
// szWindowClass: the name of the application
// szTitle: the text that appears in the title bar
// WS_OVERLAPPEDWINDOW: the type of window to create
// CW_USEDEFAULT, CW_USEDEFAULT: initial position (x, y)
// 500, 100: initial size (width, length)
// NULL: the parent of this window
// NULL: this application dows not have a menu bar
// hInstance: the first parameter from WinMain
// NULL: not used in this application
HWND hWnd = CreateWindow(
szWindowClass,
szTitle,
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, CW_USEDEFAULT,
500, 100,
NULL,
NULL,
hInstance,
NULL
);
if (!hWnd)
{
MessageBox(NULL,
_T("Call to CreateWindow failed!"),
_T("Win32 Guided Tour"),
NULL); return 1;
}
// The parameters to ShowWindow explained:
// hWnd: the value returned from CreateWindow
// nCmdShow: the fourth parameter from WinMain
ShowWindow(hWnd,
nCmdShow);
UpdateWindow(hWnd);
MSG msg;
while (GetMessage(&msg, NULL, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
} return (int) msg.wParam;}
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM)
{
PAINTSTRUCT ps;
HDC hdc;
TCHAR greeting[] = _T("Hello, World!"); switch (message)
{
case WM_PAINT:
hdc = BeginPaint(hWnd, &ps); // Here your application is laid out.
// For this introduction, we just print out "Hello, World!"
// in the top left corner.
TextOut(hdc,
5, 5,
greeting, _tcslen(greeting));
// End application-specific layout section. EndPaint(hWnd, &ps);
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
break;
} return 0;}
1>正在编译...
1>stdafx.cpp
1>正在编译...
1>console.cpp
1>正在编译资源清单...
1>Microsoft (R) Windows (R) Resource Compiler Version 6.0.5724.0
1>Copyright (C) Microsoft Corporation. All rights reserved.
1>正在链接...
1>LINK : fatal error LNK1104: 无法打开文件“msvcirtd.lib”
1>生成日志保存在“file://e:\Users\Administrator\Documents\Visual Studio 2008\Projects\console\console\Debug\BuildLog.htm”
1>console - 1 个错误,0 个警告
========== 生成: 成功 0 个,失败 1 个,最新 0 个,跳过 0 个 ==========
之前是将下载的ISO文件解压到硬盘再安装。