Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/visual-studio/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ Visual Studio未创建.exe文件_C++_Visual Studio_File_Directx_Executable - Fatal编程技术网

C++ Visual Studio未创建.exe文件

C++ Visual Studio未创建.exe文件,c++,visual-studio,file,directx,executable,C++,Visual Studio,File,Directx,Executable,事实上,我刚刚发现了另一个与我自己的相同的线程,已经解决了,很抱歉重复 链接到已解决的线程: 因此,我在一本Begginer的书的帮助下开始尝试一些DirectX 11,尽管在第一次调试时,我遇到了一些错误:s 我甚至从书中逐字复制了代码,只是为了确保我没有犯任何愚蠢的语法错误,尽管我仍然得到错误: 无法启动程序“C:…..\DXBlankWindow.exe”。系统找不到指定的文件 错误1: 错误LNK2019:未解析的外部符号“long stdcall WndProc(struct HWND

事实上,我刚刚发现了另一个与我自己的相同的线程,已经解决了,很抱歉重复

链接到已解决的线程:

因此,我在一本Begginer的书的帮助下开始尝试一些DirectX 11,尽管在第一次调试时,我遇到了一些错误:s

我甚至从书中逐字复制了代码,只是为了确保我没有犯任何愚蠢的语法错误,尽管我仍然得到错误:

无法启动程序“C:…..\DXBlankWindow.exe”。系统找不到指定的文件

错误1:

错误LNK2019:未解析的外部符号“long stdcall WndProc(struct HWND*,unsigned int,unsigned int,long)”(?WndProc@@YGJPAUHWND__@@IIJ@Z)在函数中引用_wWinMain@16C:\Users\Tim\Documents\Visual Studio 2010\Projects\DirectXTuts\DXBlankWindow\DXBlankWindow\main.obj

错误2:

错误LNK1120:1未解析的外部C:\Users\Tim\Documents\Visual Studio 2010\Projects\DirectXTuts\DXBlankWindow\Debug\DXBlankWindow.exe 1

检查项目调试文件夹后,没有创建.exe文件

我还运行了一个简单的程序来检查项目是否会运行,它做得很好并创建了.exe文件,我还将运行库更改为“多线程调试(/MTd)”

我可能做错了一些非常基本、非常简单的事情,但我一辈子都搞不清楚是什么。任何帮助都将不胜感激。我想除了下面的代码,没有什么要说的了:

#include<Windows.h>

// Define WndProc
LRESULT CALLBACK WndProc( HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam );

// Program Entry Point
int WINAPI wWinMain( HINSTANCE hInstance, HINSTANCE prevInstance, LPWSTR cmdLine, int cmdShow )
{

// Define unused parameters
UNREFERENCED_PARAMETER( prevInstance );
UNREFERENCED_PARAMETER( cmdLine );

// Define Window variables
WNDCLASSEX wndClass = { 0 };
wndClass.cbSize = sizeof( WNDCLASSEX ) ;
wndClass.style = CS_HREDRAW | CS_VREDRAW;
wndClass.lpfnWndProc = WndProc;
wndClass.hInstance = hInstance;
wndClass.hCursor = LoadCursor( NULL, IDC_ARROW );
wndClass.hbrBackground = ( HBRUSH )( COLOR_WINDOW + 1 );
wndClass.lpszMenuName = NULL;
wndClass.lpszClassName = "DX11BookWindowClass";

// Check if wndClass is being registered, if not error.
if( !RegisterClassEx( &wndClass ) )
return -1;

// Create a RECT to hold the screen positions
RECT rc = { 0, 0, 640, 480 };
AdjustWindowRect( &rc, WS_OVERLAPPEDWINDOW, FALSE );


// Create The Window through ANSI
HWND hwnd = CreateWindowA( "DX11BookWindowClass", "Blank Win32 Window",
WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, rc.right - rc. left,
rc.bottom - rc.top, NULL, NULL, hInstance, NULL );

if( !hwnd )
return -1;

ShowWindow( hwnd, cmdShow );


// Demo Initialize

MSG msg = { 0 };

while( msg.message != WM_QUIT )
{
if( PeekMessage( &msg, 0, 0, 0, PM_REMOVE ) )
{
TranslateMessage( &msg );
DispatchMessage( &msg );
}

// Update
// Draw
}

// Demo Shutdown

return static_cast<int>( msg.wParam );
}

Thanks again.
#包括
//定义WndProc
LRESULT回调WndProc(HWND HWND,UINT消息,WPARAM WPARAM,LPARAM LPARAM);
//程序入口点
int-WINAPI-wWinMain(HINSTANCE-HINSTANCE、HINSTANCE-prevInstance、LPWSTR-cmdLine、int-cmdShow)
{
//定义未使用的参数
未引用的_参数(prevInstance);
未引用的_参数(cmdLine);
//定义窗口变量
wndClass x wndClass={0};
wndClass.cbSize=sizeof(WNDCLASSEX);
wndClass.style=CS_HREDRAW | CS_VREDRAW;
wndClass.lpfnWndProc=WndProc;
wndClass.hInstance=hInstance;
wndClass.hCursor=LoadCursor(空,IDC_箭头);
wndClass.hbrBackground=(HBRUSH)(颜色窗口+1);
wndClass.lpszMenuName=NULL;
wndClass.lpszClassName=“DX11BookWindowClass”;
//检查wndClass是否正在注册,如果没有,则返回错误。
如果(!RegisterClass(&wndClass))
返回-1;
//创建一个矩形以保持屏幕位置
RECT rc={0,060480};
AdjustWindowRect(&rc,WS_OVERLAPPEDWINDOW,FALSE);
//通过ANSI创建窗口
HWND HWND=CreateWindowA(“DX11BookWindowClass”,“空白Win32窗口”,
WS_OVERLAPPEDWINDOW,CW_USEDEFAULT,CW_USEDEFAULT,rc.right-rc.left,
rc.bottom-rc.top,NULL,NULL,hInstance,NULL);
如果(!hwnd)
返回-1;
ShowWindow(hwnd、cmdShow);
//演示初始化
MSG={0};
while(msg.message!=WM_退出)
{
如果(消息(&msg,0,0,0,PM_删除))
{
翻译信息(&msg);
发送消息(&msg);
}
//更新
//画
}
//演示关机
返回静态_cast(msg.wParam);
}
再次感谢。
不,它没有定义
WndProc
,它声明了
WndProc
。换句话说,这告诉代码的其余部分在某个地方有一个
WndProc
,因此
wndClass.lpfnWndProc=WndProc不会导致编译错误。这取决于您是否确实拥有
WndProc
。这就是链接器错误消息试图告诉您的内容

或者,更简单地说,如果您告诉系统使用一个不存在的
WndProc
,那么系统除了告诉您之外什么也做不了


编辑:看着副本,你似乎在使用一本样本不完整的书。我不熟悉这本书,但如果这给您带来了麻烦,您可能想再找一本。

这本书的可能副本可能会被命名为Linker ERROR2019,因为我想这就是问题所在
// Define WndProc
LRESULT CALLBACK WndProc( HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam );