Link error, please help Topic is solved

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.
jjoe
Earned a small fee
Earned a small fee
Posts: 23
Joined: Sun May 28, 2006 10:46 pm

Link error, please help

Post by jjoe »

Code: Select all

Compiling...
main.cpp
Linking...
wxbase26d.lib(filefn.obj) : error LNK2019: unresolved external symbol __imp__fileno referenced in function "enum wxFileKind __cdecl wxGetFileKind(struct _iobuf *)" (?wxGetFileKind@@YA?AW4wxFileKind@@PAU_iobuf@@@Z)
wxbase26d.lib(datetime.obj) : error LNK2001: unresolved external symbol __imp__timezone
C:\Documents and Settings\Joe\Desktop\wggg\Debug\wggg.exe : fatal error LNK1120: 2 unresolved externals
Build log was saved at "file://c:\Documents and Settings\Joe\Desktop\wggg\wggg\Debug\BuildLog.htm"
wggg - 3 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
I compiled wx library in "multithread debug dll" mode, and so does my simple application. Then ignore "oldnames.lib." Please help me to solve those link errors.
Dandel1984
Knows some wx things
Knows some wx things
Posts: 40
Joined: Wed Jun 01, 2005 3:52 am

Post by Dandel1984 »

i have 4 quick questions for some idea as to what's going wrong..

1) what was the make command you used to compile wxwidgets ( if you don't know recompile it )
2) did the samples and some of the contributed files compile properly when you tried?
3) what is the libraries you are linking against?
4) what are your linker flags you are using?
jjoe
Earned a small fee
Earned a small fee
Posts: 23
Joined: Sun May 28, 2006 10:46 pm

Post by jjoe »

My computer is Windows XP sp2 with VC 2005 pro.
I followed the instructions here: http://www.wxwidgets.org/wiki/index.php ... _WxWidgets
According to that web page, I will build static link libraries in both Debug and Release mode.

1. Install wxMSW-2.6.3-Setup-1.exe. (All default settings)

2. Double click "C:\wxWidgets-2.6.3\build\msw\wx.dsw".
  • - Select "Yes to all" to convert all projects to VC 2005.
    - For each project, right click, click Properties. Configuration Properties -> C/C++ -> Code Generation
    • - For Debug, change Run Time Library to Multi-Threaded Debug
      - For Release, change Runtime Library to Multi-Threaded
    - Select Build->Batch build, and select all "Debug" and "Release" builds (not dll or unicode), press build.
    - get "Build: 36 succeeded, 0 failed, 0 up-to-date, 0 skipped."
    - close the VC window.
3. Double click "C:\wxWidgets-2.6.3\src\wxWindows.dsw."
  • - Select "Yes to all" to convert all projects to VC 2005.
    - For each project, right click, click Properties. Configuration Properties -> C/C++ -> Code Generation
    • - For Debug, change Run Time Library to Multi-Threaded Debug
      - For Release, change Runtime Library to Multi-Threaded
      - these actions are referenced from "How to setup MS VISUAL STUDIO .NET 2003" in http://forums.wxwidgets.org/viewtopic.php?t=255
    - Select Build->Batch build, and select all "Debug" and "Release" builds (not dll or unicode), press build.
    - get "Build: 14 succeeded, 0 failed, 0 up-to-date, 0 skipped."
    - close the VC window.
4. Test the minimal code.
  • - Create a new Win32 empty project, add a new main.cpp into it.
    - Paste the minimal code from http://forums.wxwidgets.org/viewtopic.php?t=255 to main.cpp.
    - Configure properties different from default:
    • - Character Set: Not Set
      - Additional Include Directories: $(WXWIN)\include;$(WXWIN)\contrib\include;$(WXWIN)\lib\vc_lib\mswd
      - Preprocessor Definitions: WIN32;_DEBUG;__WXMSW__;__WXDEBUG__;_WINDOWS;NOPCH;_CRT_NONSTDC_NO_DEPRECATE
      - Runtime Library: Multi-Threaded Debug (/MTd)
      - Additional Library Directories: "$(WXWIN)\lib";"$(WXWIN)\contrib\lib";"$(WXWIN)\lib\vc_lib"
      - Additional Dependencies: wxmsw26d_core.lib wxbase26d.lib wxtiffd.lib wxjpegd.lib wxpngd.lib wxzlibd.lib wxregexd.lib wxexpatd.lib winmm.lib comctl32.lib rpcrt4.lib wsock32.lib oleacc.lib odbc32.lib
      - Generate Manifest: No
5. Build the solution under Debug.
  • - Errors shows "can't find LIBCMTD.lib and OLDNAMES.lib" respectively.
    - Add Ignored Specific Library: LIBCMTD.lib;OLDNAMES.lib
    - Build again.
6. Results: 2368 error(s)(242kb)
jjoe
Earned a small fee
Earned a small fee
Posts: 23
Joined: Sun May 28, 2006 10:46 pm

Post by jjoe »

If the test project is set to "Multi-threaded Debug DLL (/MDd)," the errors would be

Code: Select all

------ Build started: Project: wxtest, Configuration: Debug Win32 ------
Compiling...
main.cpp
Linking...
wxbase26d.lib(filefn.obj) : error LNK2019: unresolved external symbol _fileno referenced in function "enum wxFileKind __cdecl wxGetFileKind(struct _iobuf *)" (?wxGetFileKind@@YA?AW4wxFileKind@@PAU_iobuf@@@Z)
wxbase26d.lib(datetime.obj) : error LNK2001: unresolved external symbol _timezone
C:\wxtest\Debug\wxtest.exe : fatal error LNK1120: 2 unresolved externals
Build log was saved at "file://c:\wxtest\wxtest\Debug\BuildLog.htm"
wxtest - 3 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
jjoe
Earned a small fee
Earned a small fee
Posts: 23
Joined: Sun May 28, 2006 10:46 pm

Post by jjoe »

jjoe
Earned a small fee
Earned a small fee
Posts: 23
Joined: Sun May 28, 2006 10:46 pm

Post by jjoe »

I uninstalled my VC 2005 pro, and did a fresh install of VC 2005 express + Platform SDK. That works!

I don't know what's wrong with the previous VC. But I followed the how-to at http://forums.wxwidgets.org/viewtopic.p ... sc&start=0
, it works greatly.