Visual Studio Express 2010 でコードをビルドして実行しようとすると、次のエラーが表示されます。
1> Generating Code...
1>Purple Health.obj : error LNK2028: unresolved token (0A000035) "extern "C" int __stdcall ExitWindowsEx(unsigned int,unsigned long)" (?ExitWindowsEx@@$$J18YGHIK@Z) referenced in function "private: void __clrcall PurpleHealth::FormOutOfTime::btnLogout_Click(class System::Object ^,class System::EventArgs ^)" (?btnLogout_Click@FormOutOfTime@PurpleHealth@@$$FA$AAMXP$AAVObject@System@@P$AAVEventArgs@4@@Z)
1>FormLauncher.obj : error LNK2028: unresolved token (0A000031) "extern "C" int __stdcall ExitWindowsEx(unsigned int,unsigned long)" (?ExitWindowsEx@@$$J18YGHIK@Z) referenced in function "private: void __clrcall PurpleHealth::FormOutOfTime::btnLogout_Click(class System::Object ^,class System::EventArgs ^)" (?btnLogout_Click@FormOutOfTime@PurpleHealth@@$$FA$AAMXP$AAVObject@System@@P$AAVEventArgs@4@@Z)
1>FormLauncher.obj : error LNK2019: unresolved external symbol "extern "C" int __stdcall ExitWindowsEx(unsigned int,unsigned long)" (?ExitWindowsEx@@$$J18YGHIK@Z) referenced in function "private: void __clrcall PurpleHealth::FormOutOfTime::btnLogout_Click(class System::Object ^,class System::EventArgs ^)" (?btnLogout_Click@FormOutOfTime@PurpleHealth@@$$FA$AAMXP$AAVObject@System@@P$AAVEventArgs@4@@Z)
1>Purple Health.obj : error LNK2001: unresolved external symbol "extern "C" int __stdcall ExitWindowsEx(unsigned int,unsigned long)" (?ExitWindowsEx@@$$J18YGHIK@Z)
1>C:\Users\Graham\documents\visual studio 2010\Projects\Purple Health\Debug\Purple Health.exe : fatal error LNK1120: 3 unresolved externals
私のコードは次のようになります(重要でない部分は編集されています):
#include "FormParentalOverride.h"
#include "Windows.h"
#include <iostream>
#using <System.dll>
#using <System.Windows.Forms.dll>
#using <System.Drawing.dll>
#pragma once
namespace PurpleHealth {
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
using namespace System::IO;
using namespace System::Text;
public ref class FormOutOfTime : public System::Windows::Forms::Form
{
private: System::Void btnLogout_Click(System::Object^ sender, System::EventArgs^ e) {
ExitWindowsEx(EWX_LOGOFF, SHTDN_REASON_MAJOR_APPLICATION);
//ExitWindows(0, 0);
}
};
}
どんな提案でも大歓迎です!