helloworld linking error in windows with vc++2005

Do you have a question about makefiles, a compiler or IDE you are using and need to know how to set it up for wxWidgets or why it doesn't compile but other IDE's do ? Post your questions here.
Post Reply
pathzl
In need of some credit
In need of some credit
Posts: 5
Joined: Wed Sep 03, 2008 4:30 pm

helloworld linking error in windows with vc++2005

Post by pathzl » Wed Sep 03, 2008 5:24 pm

hi all,I am new in wxWidgest,and now I want to try the helloworld demo of the wxWigest in windows with VC++2005 express.
I follow the wiki tourials creating a programe by hand,
1) New a Win32 Project(Empty Project).
2) Just add a single source file, called helloworld.cpp.
3) Paste demo code into it.
4) Change project configuration
a) Add additional "Include" paths $(WXWIN)\)include\";"$(WXWIN)\lib\vc_lib\mswd";"$(WXWIN)\contrib\include"
b) Add additional "Libs" paths "$(WXWIN)\lib\vc_dll";"$(WXWIN)\lib\vc_lib";"$(WXWIN)\contrib\lib";"$(WXWIN)\lib"
c) Specify libs:
wxmsw28d_core.lib wxbase28d.lib wxtiffd.lib wxjpegd.lib wxpngd.lib wxzlibd.lib wxregexd.lib wxexpatd.lib winmm.lib comctl32.lib rpcrt4.lib wsock32.lib opengl32.lib glu32.lib oleacc.lib wxmsw28d_gl.lib
5) Build the project

And I got the following errors,could anyone help me please?
and I should mention that before this I used the "setup.h" which Audacity(an open audio sofware with wxWigest) supply to build the wxWigest libs instead of
the original one.

Code: Select all

------ Rebuild All started: Project: wxhelloworld, Configuration: Debug Win32 ------
Deleting intermediate and output files for project 'wxhelloworld', configuration 'Debug|Win32'
Compiling...
wxhelloworld.cpp
Linking...
wxhelloworld.obj : error LNK2001: unresolved external symbol "protected: static struct wxEventTable const wxFrame::sm_eventTable" ([email protected]@@[email protected]@B)
wxhelloworld.obj : error LNK2019: unresolved external symbol "protected: static class wxAppConsole * wxAppConsole::ms_appInstance" ([email protected]@@[email protected]) referenced in function "public: static class wxAppConsole * __cdecl wxAppConsole::GetInstance(void)" ([email protected]@@[email protected])
wxhelloworld.obj : error LNK2019: unresolved external symbol "public: static unsigned int const wxStringBase::npos" ([email protected]@@2IB) referenced in function "public: __thiscall wxStringBase::wxStringBase(char const *)" ([email protected]@[email protected]@Z)
wxhelloworld.obj : error LNK2019: unresolved external symbol "char const * const wxStatusLineNameStr" ([email protected]@3QBDB) referenced in function "public: __thiscall MyFrame::MyFrame(class wxString const &,class wxPoint const &,class wxSize const &)" ([email protected]@[email protected]@@[email protected]@[email protected]@@Z)
wxhelloworld.obj : error LNK2019: unresolved external symbol "char const * const wxEmptyString" ([email protected]@3PBDB) referenced in function "public: __thiscall MyFrame::MyFrame(class wxString const &,class wxPoint const &,class wxSize const &)" ([email protected]@[email protected]@@[email protected]@[email protected]@@Z)
wxhelloworld.obj : error LNK2019: unresolved external symbol "char const * const wxFrameNameStr" ([email protected]@3QBDB) referenced in function "public: __thiscall MyFrame::MyFrame(class wxString const &,class wxPoint const &,class wxSize const &)" ([email protected]@[email protected]@@[email protected]@[email protected]@@Z)
wxhelloworld.obj : error LNK2019: unresolved external symbol "int const wxEVT_NULL" ([email protected]@3HB) referenced in function "void __cdecl `dynamic initializer for 'private: static struct wxEventTableEntry const * const MyFrame::sm_eventTableEntries''(void)" ([email protected]@@[email protected]@[email protected]@YAXXZ)
wxhelloworld.obj : error LNK2019: unresolved external symbol "int const wxEVT_COMMAND_MENU_SELECTED" ([email protected]@3HB) referenced in function "void __cdecl `dynamic initializer for 'private: static struct wxEventTableEntry const * const MyFrame::sm_eventTableEntries''(void)" ([email protected]@@[email protected]@[email protected]@YAXXZ)
wxhelloworld.obj : error LNK2019: unresolved external symbol "protected: static class wxAppConsole * (__cdecl* wxAppConsole::ms_appInitFn)(void)" ([email protected]@@[email protected]) referenced in function "public: static void __cdecl wxAppConsole::SetInitializerFunction(class wxAppConsole * (__cdecl*)(void))" ([email protected]@@[email protected]@Z)
E:\cg opengl\wx\wxhelloworld\Debug\wxhelloworld.exe : fatal error LNK1120: 9 unresolved externals
Build log was saved at "file://e:\cg opengl\wx\wxhelloworld\Debug\BuildLog.htm"
wxhelloworld - 10 error(s), 0 warning(s)
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========

bloodlee
Experienced Solver
Experienced Solver
Posts: 77
Joined: Thu Nov 30, 2006 10:49 am
Location: Shenzhen, CHN

Post by bloodlee » Wed Sep 03, 2008 5:57 pm

Hi, pathzl.

Please check which run library you are using in your compile configuration. It's in C/C++ -> Code Generation -> Run Library.

You should keep it the same with your wxWidgets configuration.

Regards.

pathzl
In need of some credit
In need of some credit
Posts: 5
Joined: Wed Sep 03, 2008 4:30 pm

Post by pathzl » Thu Sep 04, 2008 3:15 am

thx bloodlee,do you mean runtime libirary?
I have set that to be the same with wxWigest as following.
Multi-threaded Debug DLL (/MDd)
but in fact I have tried all the options but result in more or less linking errors.

Grrr
Earned some good credits
Earned some good credits
Posts: 126
Joined: Fri Apr 11, 2008 8:48 am
Location: Netherlands

Post by Grrr » Thu Sep 04, 2008 6:58 am

Did you build any of the samples? Did they work?

If the samples do work, check all the settings with yours.

You mention you used setup.h from another project. I think you should use the setup.h supplied with wxWidgets and build both the wx libraries AND your app with the same setup.h file.

bloodlee
Experienced Solver
Experienced Solver
Posts: 77
Joined: Thu Nov 30, 2006 10:49 am
Location: Shenzhen, CHN

Post by bloodlee » Thu Sep 04, 2008 10:42 am

If you don't mind, maybe you can upload your project here.
I can have a try! :)

pathzl
In need of some credit
In need of some credit
Posts: 5
Joined: Wed Sep 03, 2008 4:30 pm

Post by pathzl » Thu Sep 04, 2008 2:30 pm

to grrr:
thx,I tried the animate samples and it works.then I make the exact same configuration with my helloworld project,but failed in also 10
linking errors and one more warning.
and I reinstalled the wxWigest and rebuilde the libs to make sure I used the setup.h of wxWigest.

to bloodlee:
it s very nice of you!:D here s my project file.
Attachments
wxhelloworld.rar
my project file
(2.38 KiB) Downloaded 40 times

bloodlee
Experienced Solver
Experienced Solver
Posts: 77
Joined: Thu Nov 30, 2006 10:49 am
Location: Shenzhen, CHN

Post by bloodlee » Fri Sep 05, 2008 2:47 am

Hi, pathzl!

I've tried your project. I converted it to a VS 2008 Express project. Because I am still using wx2.6.2(which has many problems! :( ), I change the input libs from 28 to 26. And after that, everything was OK, just some warning message popped out.

In my opinion, that's not the problem of your project. Please check the build configuration of your wxWidgets. There maybe something inconsistent.

Good luck! :)

pathzl
In need of some credit
In need of some credit
Posts: 5
Joined: Wed Sep 03, 2008 4:30 pm

Post by pathzl » Fri Sep 05, 2008 9:13 am

thx for your help,I will tried more.
could I know which 2 input libs did you ignore?

pathzl
In need of some credit
In need of some credit
Posts: 5
Joined: Wed Sep 03, 2008 4:30 pm

Post by pathzl » Fri Sep 05, 2008 10:10 am

I used the sample s framework and coppy my helloworld s cpp to instead of the sample cpp,and it work!although I dont know what s wrong before,thx all people who want to help especially bloodlee! :D

Post Reply