LNK2028 and LNK2019 errors
LNK2028 and LNK2019 errors
我是一个完全n00b到c++的人,正在尝试制作一个简单的表单应用程序,但遇到了这种问题:
1>proyecto.obj : error LNK2028: unresolved token (0A00001E) "extern "C" int __stdcall SetWindowRgn(struct HWND__ *,struct HRGN__ *,int)" (?SetWindowRgn@@$$J212YGHPAUHWND__@@PAUHRGN__@@H@Z) referenced in function "public: __clrcall proyecto::Form1::Form1(void)" (??0Form1@proyecto@@$$FQ$AAM@XZ)
1>proyecto.obj : error LNK2028: unresolved token (0A000021) "extern "C" struct HRGN__ * __stdcall CreateRectRgn(int,int,int,int)" (?CreateRectRgn@@$$J216YGPAUHRGN__@@HHHH@Z) referenced in function "public: __clrcall proyecto::Form1::Form1(void)" (??0Form1@proyecto@@$$FQ$AAM@XZ)
1>proyecto.obj : error LNK2019: unresolved external symbol "extern "C" int __stdcall SetWindowRgn(struct HWND__ *,struct HRGN__ *,int)" (?SetWindowRgn@@$$J212YGHPAUHWND__@@PAUHRGN__@@H@Z) referenced in function "public: __clrcall proyecto::Form1::Form1(void)" (??0Form1@proyecto@@$$FQ$AAM@XZ)
1>proyecto.obj : error LNK2019: unresolved external symbol "extern "C" struct HRGN__ * __stdcall CreateRectRgn(int,int,int,int)" (?CreateRectRgn@@$$J216YGPAUHRGN__@@HHHH@Z) referenced in function "public: __clrcall proyecto::Form1::Form1(void)" (??0Form1@proyecto@@$$FQ$AAM@XZ)
在谷歌上搜索了30分钟,从解决方案到线程都无法理解这些错误。这是Form1:
#pragma once
#include <cstdlib>
#include <windows.h>
namespace proyecto {
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
/// <summary>
/// Summary for Form1
/// </summary>
public ref class Form1 : public System::Windows::Forms::Form
{
public:
Form1(void)
{
InitializeComponent();
HRGN hrgn = CreateRectRgn(0, 0, 300, 256);
HWND hwnd=(HWND)Handle.ToPointer();
SetWindowRgn(hwnd, hrgn, true);
}
protected:
/// <summary>
/// Clean up any resources being used.
/// </summary>
~Form1()
{
if (components)
{
delete components;
}
}
private:
/// <summary>
/// Required designer variable.
/// </summary>
System::ComponentModel::Container ^components;
#pragma region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
void InitializeComponent(void)
{
this->SuspendLayout();
//
// Form1
//
this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->ClientSize = System::Drawing::Size(284, 262);
this->ControlBox = false;
this->FormBorderStyle = System::Windows::Forms::FormBorderStyle::FixedToolWindow;
this->Name = L"Form1";
this->ShowIcon = false;
this->Text = L"Form1";
this->ResumeLayout(false);
}
#pragma endregion
};
}
根据Microsoft的SetWindowRgn文档,您需要链接到User32.lib。这将为驻留在Windows中的User32.dll提供必要的挂钩。
相关文章:
- 使用 GCC 卸载的 OpenMP 卸载失败,并出现"Ptx assembly aborted due to errors"
- 类C++中的函数问题(LNK2019和LNK1120错误)
- CppSQLite 抛出"LNK2019: unresolved external symbol"错误
- Visual Studio中的wxwidgets应用程序给出错误"LNK2019 unresolved external symbol"
- 什么会导致LNK2019 VisualStudio中的错误?
- 构建 Tensorflow 调试时出现错误LNK2019
- LNK2019 在文件中调用静态成员的方法时出错.cpp
- 错误LNK2019未解析的外部符号"public: __thiscall SLinkList<char>::SLinkList<char>(void)"
- Qt C++LNK2019:使用QNetworkAccessManager未解析的外部符号
- 链接CPP文件进行测试时发生LNK2019错误
- LNK2019:C++/CLI 中未解析的外部符号
- 函数 LNK2019 "int __cdecl __scrt_common_main_seh(void)" 中引用的未解析外部符号主错误 (?__scrt_common_main_seh@@YAHXZ
- 皮克斯美元LNK2019:未解析的外部交易品种
- LNK2019未解析的外部符号"公共:__thiscall
- 32位到64位:LNK2019错误,如何检索相关信息
- Google Test:错误 LNK2019:使用 Visual Studio 2017 与 CMake 进行未解析的外
- LNK2019 - 在VS2017中使用Freeling
- 在结构函数之间传递文件路径 C++ 编辑:修复LNK2019错误
- LNK2019和LNK1120错误,未解析的外部和未解析的符号
- LNK2028 and LNK2019 errors