为什么老是报这个错误MSVCRT.lib(crtexew.obj) : error LNK2019: 无法解析的外部符号

这是wxWidgets论坛的中文版本。在这里,您可以用您的母语汉语讨论上面任一子论坛所涉及的所有关于wxWidgets的话题。欢迎大家参与到对有价值的帖子的中英互译工作中来!
Post Reply
xiaoyaotian789
In need of some credit
In need of some credit
Posts: 1
Joined: Wed Sep 05, 2012 7:28 am

为什么老是报这个错误MSVCRT.lib(crtexew.obj) : error LNK2019: 无法解析的外部符号

Post by xiaoyaotian789 »

老是报这个错误,怎么也弄不好
1>MSVCRT.lib(crtexew.obj) : error LNK2019: 无法解析的外部符号 _WinMain@16,该符号在函数 ___tmainCRTStartup 中被引用
1>vc_mswudll\except.exe : fatal error LNK1120: 1 个无法解析的外部命令



怎么办,跪求了
我是用wxWidgets界面设计工具DialogBlocks 弄出来的.C和.H文件,还有如有DialogBlocks的高手叫叫小弟我,不胜感激,我的QQ号840199890,嗯,报酬可以商量

程序如下:
.C文件://///////////////////////////////////////////////////////////////////////////
// Name: helloword.cpp
// Purpose:
// Author: zqc
// Modified by:
// Created: 04/09/2012 16:45:28
// RCS-ID:
// Copyright:
// Licence:
/////////////////////////////////////////////////////////////////////////////

// Generated by DialogBlocks (unregistered), 04/09/2012 16:45:28

// For compilers that support precompilation, includes "wx/wx.h".
#include "wx/wxprec.h"

#ifdef __BORLANDC__
#pragma hdrstop
#endif

#ifndef WX_PRECOMP
#include "wx/wx.h"
#endif

////@begin includes
#include "wx/imaglist.h"
////@end includes

#include "helloword.h"

////@begin XPM images
////@end XPM images


/*
* HelloWord type definition
*/

IMPLEMENT_CLASS( HelloWord, wxFrame )


/*
* HelloWord event table definition
*/

BEGIN_EVENT_TABLE( HelloWord, wxFrame )

////@begin HelloWord event table entries
////@end HelloWord event table entries

END_EVENT_TABLE()


/*
* HelloWord constructors
*/

HelloWord::HelloWord()
{
Init();
}

HelloWord::HelloWord( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
{
Init();
Create( parent, id, caption, pos, size, style );
}


/*
* HelloWord creator
*/

bool HelloWord::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
{
////@begin HelloWord creation
wxFrame::Create( parent, id, caption, pos, size, style );

CreateControls();
Centre();
////@end HelloWord creation
return true;
}


/*
* HelloWord destructor
*/

HelloWord::~HelloWord()
{
////@begin HelloWord destruction
////@end HelloWord destruction
}


/*
* Member initialisation
*/

void HelloWord::Init()
{
////@begin HelloWord member initialisation
////@end HelloWord member initialisation
}


/*
* Control creation for HelloWord
*/

void HelloWord::CreateControls()
{
////@begin HelloWord content construction
HelloWord* itemFrame1 = this;

wxMenuBar* menuBar = new wxMenuBar;
wxMenu* itemMenu11 = new wxMenu;
itemMenu11->Append(ID_MENUITEM, wxGetTranslation(wxString() + (wxChar) 0x65B0 + (wxChar) 0x5EFA), wxEmptyString, wxITEM_NORMAL);
itemMenu11->Append(ID_MENUITEM1, wxGetTranslation(wxString() + (wxChar) 0x5173 + (wxChar) 0x95ED), wxEmptyString, wxITEM_NORMAL);
menuBar->Append(itemMenu11, wxGetTranslation(wxString() + (wxChar) 0x6587 + (wxChar) 0x4EF6 + wxT("(F)")));
wxMenu* itemMenu14 = new wxMenu;
itemMenu14->Append(ID_MENUITEM2, wxGetTranslation(wxString() + (wxChar) 0x5206 + (wxChar) 0x6790), wxEmptyString, wxITEM_NORMAL);
menuBar->Append(itemMenu14, wxGetTranslation(wxString() + (wxChar) 0x5206 + (wxChar) 0x6790 + wxT("(A)")));
wxMenu* itemMenu16 = new wxMenu;
itemMenu16->Append(ID_MENUITEM3, wxGetTranslation(wxString() + (wxChar) 0x62A5 + (wxChar) 0x544A), wxEmptyString, wxITEM_NORMAL);
menuBar->Append(itemMenu16, wxGetTranslation(wxString() + (wxChar) 0x62A5 + (wxChar) 0x544A + wxT("(R)")));
wxMenu* itemMenu18 = new wxMenu;
itemMenu18->Append(ID_MENUITEM4, wxGetTranslation(wxString() + (wxChar) 0x5E2E + (wxChar) 0x52A9), wxEmptyString, wxITEM_NORMAL);
menuBar->Append(itemMenu18, wxGetTranslation(wxString() + (wxChar) 0x5E2E + (wxChar) 0x52A9 + wxT("(H)")));
itemFrame1->SetMenuBar(menuBar);

wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL);
itemFrame1->SetSizer(itemBoxSizer2);

wxBoxSizer* itemBoxSizer3 = new wxBoxSizer(wxVERTICAL);
itemBoxSizer2->Add(itemBoxSizer3, 0, wxALIGN_LEFT, 5);

wxStaticText* itemStaticText4 = new wxStaticText( itemFrame1, wxID_STATIC, wxGetTranslation(wxString() + (wxChar) 0x9879 + (wxChar) 0x76EE), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer3->Add(itemStaticText4, 0, wxALIGN_LEFT, 5);

wxTreeCtrl* itemTreeCtrl5 = new wxTreeCtrl( itemFrame1, ID_TREECTRL, wxDefaultPosition, wxSize(100, 190), wxTR_SINGLE );
itemBoxSizer3->Add(itemTreeCtrl5, 0, wxALIGN_LEFT, 5);

wxNotebook* itemNotebook6 = new wxNotebook( itemFrame1, ID_NOTEBOOK, wxDefaultPosition, wxSize(300, 300), wxBK_DEFAULT );

wxStaticText* itemStaticText7 = new wxStaticText( itemNotebook6, wxID_STATIC, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );

itemNotebook6->AddPage(itemStaticText7, wxGetTranslation(wxString() + (wxChar) 0x53C2 + (wxChar) 0x6570 + (wxChar) 0x7ED3 + (wxChar) 0x6784));

wxStaticText* itemStaticText8 = new wxStaticText( itemNotebook6, wxID_STATIC, _("Static text"), wxDefaultPosition, wxDefaultSize, 0 );

itemNotebook6->AddPage(itemStaticText8, wxGetTranslation(wxString() + (wxChar) 0x66F2 + (wxChar) 0x7EBF + (wxChar) 0x53CA + (wxChar) 0x5BFF + (wxChar) 0x547D));

wxStaticText* itemStaticText9 = new wxStaticText( itemNotebook6, wxID_STATIC, _("Static text"), wxDefaultPosition, wxDefaultSize, 0 );

itemNotebook6->AddPage(itemStaticText9, wxGetTranslation(wxString() + (wxChar) 0x5206 + (wxChar) 0x6790 + (wxChar) 0x62A5 + (wxChar) 0x544A));

itemBoxSizer2->Add(itemNotebook6, 0, wxGROW, 5);

wxToolBar* itemToolBar20 = CreateToolBar( wxTB_FLAT|wxTB_HORIZONTAL, ID_TOOLBAR );
wxBitmap itemtool21Bitmap(itemFrame1->GetBitmapResource(wxT("../picture/new.bmp")));
wxBitmap itemtool21BitmapDisabled;
itemToolBar20->AddTool(ID_TOOL, wxGetTranslation(wxString() + (wxChar) 0x65B0 + (wxChar) 0x5EFA), itemtool21Bitmap, itemtool21BitmapDisabled, wxITEM_NORMAL, wxEmptyString, wxEmptyString);
wxBitmap itemtool22Bitmap(itemFrame1->GetBitmapResource(wxT("../picture/open.bmp")));
wxBitmap itemtool22BitmapDisabled;
itemToolBar20->AddTool(ID_TOOL1, wxEmptyString, itemtool22Bitmap, itemtool22BitmapDisabled, wxITEM_NORMAL, wxEmptyString, wxEmptyString);
wxBitmap itemtool23Bitmap(itemFrame1->GetBitmapResource(wxT("../picture/save.bmp")));
wxBitmap itemtool23BitmapDisabled;
itemToolBar20->AddTool(ID_TOOL2, wxEmptyString, itemtool23Bitmap, itemtool23BitmapDisabled, wxITEM_NORMAL, wxEmptyString, wxEmptyString);
wxBitmap itemtool24Bitmap(itemFrame1->GetBitmapResource(wxT("../picture/1.bmp")));
wxBitmap itemtool24BitmapDisabled;
itemToolBar20->AddTool(ID_TOOL3, wxEmptyString, itemtool24Bitmap, itemtool24BitmapDisabled, wxITEM_NORMAL, wxEmptyString, wxEmptyString);
wxBitmap itemtool25Bitmap(itemFrame1->GetBitmapResource(wxT("../picture/2.bmp")));
wxBitmap itemtool25BitmapDisabled;
itemToolBar20->AddTool(ID_TOOL4, wxEmptyString, itemtool25Bitmap, itemtool25BitmapDisabled, wxITEM_NORMAL, wxEmptyString, wxEmptyString);
wxBitmap itemtool26Bitmap(itemFrame1->GetBitmapResource(wxT("../picture/3.bmp")));
wxBitmap itemtool26BitmapDisabled;
itemToolBar20->AddTool(ID_TOOL5, wxEmptyString, itemtool26Bitmap, itemtool26BitmapDisabled, wxITEM_NORMAL, wxEmptyString, wxEmptyString);
wxBitmap itemtool27Bitmap(itemFrame1->GetBitmapResource(wxT("../picture/4.bmp")));
wxBitmap itemtool27BitmapDisabled;
itemToolBar20->AddTool(ID_TOOL6, wxEmptyString, itemtool27Bitmap, itemtool27BitmapDisabled, wxITEM_NORMAL, wxEmptyString, wxEmptyString);
wxBitmap itemtool28Bitmap(itemFrame1->GetBitmapResource(wxT("../picture/5.bmp")));
wxBitmap itemtool28BitmapDisabled;
itemToolBar20->AddTool(ID_TOOL7, wxEmptyString, itemtool28Bitmap, itemtool28BitmapDisabled, wxITEM_NORMAL, wxEmptyString, wxEmptyString);
wxBitmap itemtool29Bitmap(itemFrame1->GetBitmapResource(wxT("../picture/calculation.bmp")));
wxBitmap itemtool29BitmapDisabled;
itemToolBar20->AddTool(ID_TOOL8, wxEmptyString, itemtool29Bitmap, itemtool29BitmapDisabled, wxITEM_NORMAL, wxEmptyString, wxEmptyString);
wxBitmap itemtool30Bitmap(itemFrame1->GetBitmapResource(wxT("../picture/delete.bmp")));
wxBitmap itemtool30BitmapDisabled;
itemToolBar20->AddTool(ID_TOOL9, wxEmptyString, itemtool30Bitmap, itemtool30BitmapDisabled, wxITEM_NORMAL, wxEmptyString, wxEmptyString);
wxBitmap itemtool31Bitmap(itemFrame1->GetBitmapResource(wxT("../picture/print.bmp")));
wxBitmap itemtool31BitmapDisabled;
itemToolBar20->AddTool(ID_TOOL10, wxEmptyString, itemtool31Bitmap, itemtool31BitmapDisabled, wxITEM_NORMAL, wxEmptyString, wxEmptyString);
itemToolBar20->Realize();
itemFrame1->SetToolBar(itemToolBar20);

wxStatusBar* itemStatusBar32 = new wxStatusBar( itemFrame1, ID_STATUSBAR, wxST_SIZEGRIP|wxNO_BORDER );
itemStatusBar32->SetFieldsCount(2);
itemFrame1->SetStatusBar(itemStatusBar32);

////@end HelloWord content construction
}


/*
* Should we show tooltips?
*/

bool HelloWord::ShowToolTips()
{
return true;
}

/*
* Get bitmap resources
*/

wxBitmap HelloWord::GetBitmapResource( const wxString& name )
{
// Bitmap retrieval
////@begin HelloWord bitmap retrieval
wxUnusedVar(name);
if (name == _T("../picture/new.bmp"))
{
wxBitmap bitmap(_T("../picture/new.bmp"), wxBITMAP_TYPE_BMP);
return bitmap;
}
else if (name == _T("../picture/open.bmp"))
{
wxBitmap bitmap(_T("../picture/open.bmp"), wxBITMAP_TYPE_BMP);
return bitmap;
}
else if (name == _T("../picture/save.bmp"))
{
wxBitmap bitmap(_T("../picture/save.bmp"), wxBITMAP_TYPE_BMP);
return bitmap;
}
else if (name == _T("../picture/1.bmp"))
{
wxBitmap bitmap(_T("../picture/1.bmp"), wxBITMAP_TYPE_BMP);
return bitmap;
}
else if (name == _T("../picture/2.bmp"))
{
wxBitmap bitmap(_T("../picture/2.bmp"), wxBITMAP_TYPE_BMP);
return bitmap;
}
else if (name == _T("../picture/3.bmp"))
{
wxBitmap bitmap(_T("../picture/3.bmp"), wxBITMAP_TYPE_BMP);
return bitmap;
}
else if (name == _T("../picture/4.bmp"))
{
wxBitmap bitmap(_T("../picture/4.bmp"), wxBITMAP_TYPE_BMP);
return bitmap;
}
else if (name == _T("../picture/5.bmp"))
{
wxBitmap bitmap(_T("../picture/5.bmp"), wxBITMAP_TYPE_BMP);
return bitmap;
}
else if (name == _T("../picture/calculation.bmp"))
{
wxBitmap bitmap(_T("../picture/calculation.bmp"), wxBITMAP_TYPE_BMP);
return bitmap;
}
else if (name == _T("../picture/delete.bmp"))
{
wxBitmap bitmap(_T("../picture/delete.bmp"), wxBITMAP_TYPE_BMP);
return bitmap;
}
else if (name == _T("../picture/print.bmp"))
{
wxBitmap bitmap(_T("../picture/print.bmp"), wxBITMAP_TYPE_BMP);
return bitmap;
}
return wxNullBitmap;
////@end HelloWord bitmap retrieval
}

/*
* Get icon resources
*/

wxIcon HelloWord::GetIconResource( const wxString& name )
{
// Icon retrieval
////@begin HelloWord icon retrieval
wxUnusedVar(name);
return wxNullIcon;
////@end HelloWord icon retrieval
}



.H头文件是这个样的:
/////////////////////////////////////////////////////////////////////////////
// Name: helloword.h
// Purpose:
// Author: zqc
// Modified by:
// Created: 04/09/2012 16:45:28
// RCS-ID:
// Copyright:
// Licence:
/////////////////////////////////////////////////////////////////////////////

// Generated by DialogBlocks (unregistered), 04/09/2012 16:45:28

#ifndef _HELLOWORD_H_
#define _HELLOWORD_H_


/*!
* Includes
*/

////@begin includes
#include "wx/frame.h"
#include "wx/treectrl.h"
#include "wx/notebook.h"
#include "wx/toolbar.h"
#include "wx/statusbr.h"
////@end includes

/*!
* Forward declarations
*/

////@begin forward declarations
////@end forward declarations

/*!
* Control identifiers
*/

////@begin control identifiers
#define ID_HELLOWORD 10000
#define ID_TREECTRL 10001
#define ID_NOTEBOOK 10003
#define ID_MENUITEM 10005
#define ID_MENUITEM1 10006
#define ID_MENUITEM2 10009
#define ID_MENUITEM3 10010
#define ID_MENUITEM4 10011
#define ID_TOOLBAR 10007
#define ID_TOOL 10008
#define ID_TOOL1 10004
#define ID_TOOL2 10012
#define ID_TOOL3 10013
#define ID_TOOL4 10014
#define ID_TOOL5 10015
#define ID_TOOL6 10016
#define ID_TOOL7 10017
#define ID_TOOL8 10018
#define ID_TOOL9 10019
#define ID_TOOL10 10020
#define ID_STATUSBAR 10002
#define SYMBOL_HELLOWORD_STYLE wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX
#define SYMBOL_HELLOWORD_TITLE wxGetTranslation(wxString() + (wxChar) 0x8F74 + (wxChar) 0x627F + (wxChar) 0x8F6F + (wxChar) 0x4EF6)
#define SYMBOL_HELLOWORD_IDNAME ID_HELLOWORD
#define SYMBOL_HELLOWORD_SIZE wxSize(650, 650)
#define SYMBOL_HELLOWORD_POSITION wxDefaultPosition
////@end control identifiers


/*!
* HelloWord class declaration
*/

class HelloWord: public wxFrame
{
DECLARE_CLASS( HelloWord )
DECLARE_EVENT_TABLE()

public:
/// Constructors
HelloWord();
HelloWord( wxWindow* parent, wxWindowID id = SYMBOL_HELLOWORD_IDNAME, const wxString& caption = SYMBOL_HELLOWORD_TITLE, const wxPoint& pos = SYMBOL_HELLOWORD_POSITION, const wxSize& size = SYMBOL_HELLOWORD_SIZE, long style = SYMBOL_HELLOWORD_STYLE );

bool Create( wxWindow* parent, wxWindowID id = SYMBOL_HELLOWORD_IDNAME, const wxString& caption = SYMBOL_HELLOWORD_TITLE, const wxPoint& pos = SYMBOL_HELLOWORD_POSITION, const wxSize& size = SYMBOL_HELLOWORD_SIZE, long style = SYMBOL_HELLOWORD_STYLE );

/// Destructor
~HelloWord();

/// Initialises member variables
void Init();

/// Creates the controls and sizers
void CreateControls();

////@begin HelloWord event handler declarations

////@end HelloWord event handler declarations

////@begin HelloWord member function declarations

/// Retrieves bitmap resources
wxBitmap GetBitmapResource( const wxString& name );

/// Retrieves icon resources
wxIcon GetIconResource( const wxString& name );
////@end HelloWord member function declarations

/// Should we show tooltips?
static bool ShowToolTips();

////@begin HelloWord member variables
////@end HelloWord member variables
};

#endif
// _HELLOWORD_H_
samsam598
Super wx Problem Solver
Super wx Problem Solver
Posts: 340
Joined: Mon Oct 06, 2008 12:55 pm

Re: 为什么老是报这个错误MSVCRT.lib(crtexew.obj) : error LNK2019: 无法解析的

Post by samsam598 »

粗略地看了一下,只发现一个窗体类的定义及实现,未发现主程序( 相当于void main(int argc,char* argv[]){})

main.cpp

Code: Select all

#include <wx/wx.h>
#include..
#include "helloword.h"
class MyApp:public wxApp
{
   public:
   virtual bool OnInit();
}
IMPLEMENT_APP(MyApp)

bool MyApp::OnInit()
{
    HelloWorld* mainFrame=new HelloWord(...);
    mainFrame->Show();
    return true;
}
Regards,
Sam
-------------------------------------------------------------------
Windows 10 64bit
VS Community 2019
msys2-mingw13.2.0 C::B character set: UTF-8/GBK(Chinese)
wxWidgets 3.3/3.2.4 Unicode Mono Static gcc static build
kipade
Earned some good credits
Earned some good credits
Posts: 126
Joined: Fri Nov 11, 2011 2:45 am
Location: China

Re: 为什么老是报这个错误MSVCRT.lib(crtexew.obj) : error LNK2019: 无法解析的

Post by kipade »

不用跪求都有人回复了
哈哈
Slackware GNU/Linux x86_64
wxWidgets-3.3.0
Post Reply