Author Topic: Linker Error!!!  (Read 9963 times)

Offline pabon

  • Single posting newcomer
  • *
  • Posts: 5
Linker Error!!!
« on: July 06, 2011, 09:18:42 pm »
Platform: Windows7 32bit
Compiler Visual Studio 2010/Windows SDK
Codeblocks version 10.5
wxWidgets-2.8.12

I recently installed/setup C::B to use VS2010 as my compilier/linker. I can sucessfully create/run a win32 console app. I can also create/run a win32GUI app,but when I try to create a basic wxWidget app(creating the wxsmith tutorial app). I get the following linker error:

LINK : fatal error LNK1146: no argument specified with option '/LIBPATH:'

I have setup my wx global variable to point to my installation of wxWidgets - C:\wxWidgets-2.8.12 and  I've also setup the wx/Lib to point to C:\wxWidgets-2.8.12\lib\vc_lib. My linker is also set up to point to that library location.
The following is the contents of my build log. Any assistance is greatly appreciated.

Code
-------------- Build: Release in Tutorial ---------------

cl.exe /nologo /DWIN32 /D__WIN32__ /D__WXMSW__ /D_WINDOWS /TP /Gd /GF /EHsc /D_CRT_SECURE_DEPRECATE /D_CRT_NONSTDC_NO_DEPRECATE /Zc:wchar_t /D_VC80_UPGRADE=0x0600 /W3  /Ox /DNDEBUG /MD /O2 /Ob1    /IC:\wxWidgets-2.8.12\include /IC:\wxWidgets-2.8.12\contrib\include /I\msw /I"C:\Program Files\Microsoft Visual Studio 10.0\VC\include" /I"C:\Program Files\Microsoft SDKs\Windows\v7.0A\Include"  /c TutorialMain.cpp /Foobj\Release\TutorialMain.obj
TutorialMain.cpp
C:\Program Files\Microsoft SDKs\Windows\v7.0A\bin\rc.exe /IC:\wxWidgets-2.8.12\include /I\msw /I"C:\Program Files\Microsoft Visual Studio 10.0\VC\include" /I"C:\Program Files\Microsoft SDKs\Windows\v7.0A\Include"  -foobj\Release\resource.res resource.rc
Microsoft (R) Windows (R) Resource Compiler Version 6.1.7600.16385
Copyright (C) Microsoft Corporation.  All rights reserved.
cl.exe /nologo /DWIN32 /D__WIN32__ /D__WXMSW__ /D_WINDOWS /TP /Gd /GF /EHsc /D_CRT_SECURE_DEPRECATE /D_CRT_NONSTDC_NO_DEPRECATE /Zc:wchar_t /D_VC80_UPGRADE=0x0600 /W3  /Ox /DNDEBUG /MD /O2 /Ob1    /IC:\wxWidgets-2.8.12\include /IC:\wxWidgets-2.8.12\contrib\include /I\msw /I"C:\Program Files\Microsoft Visual Studio 10.0\VC\include" /I"C:\Program Files\Microsoft SDKs\Windows\v7.0A\Include"  /c TutorialApp.cpp /Foobj\Release\TutorialApp.obj
TutorialApp.cpp
link.exe /nologo /subsystem:windows /LIBPATH: /LIBPATH:"C:\Program Files\Microsoft Visual Studio 10.0\VC\lib" /LIBPATH:"C:\Program Files\Microsoft SDKs\Windows\v7.0A\Lib" /LIBPATH:C:\wxWidgets-2.8.12\lib\vc_lib  /out:bin\Release\Tutorial.exe msvcrt.lib wxmsw_core.lib wxbase.lib wxpng.lib wxzlib.lib winmm.lib rpcrt4.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comctl32.lib wsock32.lib odbc32.lib  obj\Release\TutorialMain.obj obj\Release\TutorialApp.obj  obj\Release\resource.res  /NODEFAULTLIB:libcmt.lib /INCREMENTAL:NO /SUBSYSTEM:WINDOWS
Microsoft (R) Incremental Linker Version 10.00.40219.01
Copyright (C) Microsoft Corporation.  All rights reserved.
LINK : fatal error LNK1146: no argument specified with option '/LIBPATH:'
Process terminated with status 1146 (0 minutes, 39 seconds)
1 errors, 0 warnings
 

If you look the first line of the Linker output the first /LIBPATH  directive has no argruments. I don't know where that is comming from. Please help. Thanks in advance.

pabon

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7591
    • My Best Post
Re: Linker Error!!!
« Reply #1 on: July 06, 2011, 11:09:07 pm »
Check Compiler and Debug Settings for bad or empty lines in
"search directories" -> "linker"

Check Project Build Options for the same under all the targets
"search directories" -> "linker"

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline pabon

  • Single posting newcomer
  • *
  • Posts: 5
Re: Linker Error!!!
« Reply #2 on: July 07, 2011, 12:23:56 am »
Checked all search directories, no blank or empty lines.

Thanks for your help..

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7591
    • My Best Post
Re: Linker Error!!!
« Reply #3 on: July 07, 2011, 12:44:17 am »
Under Project Build Options
under linker settings
Check other linker options for /LIBPATH

Also check the same under Compiler and Debugger Settings

Tim S.
« Last Edit: July 07, 2011, 12:50:46 am by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline pabon

  • Single posting newcomer
  • *
  • Posts: 5
Re: Linker Error!!!
« Reply #4 on: July 07, 2011, 01:21:04 am »
the string '/LIBPATH' is not included in any of the linkers options setting for any build.

Thanks again Tim


pabon

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7591
    • My Best Post
Re: Linker Error!!!
« Reply #5 on: July 07, 2011, 01:36:47 am »
NOTE: Confirm you set the wx global variable correctly under Global Variables.
Confirm you used it right also.

The following is NOT normally the correct thing to do.
Quote
I've also setup the wx/Lib to point to C:\wxWidgets-2.8.12\lib\vc_lib.


IF Global Variable is right your config is likely wrong.

I suggest renaming your code::blocks config file and trying to setup Code::Blocks again to use MSVS.

Under %APPDATA%\codeblocks standard name is default.conf
Must NOT be Running Code::Blocks when renaming or deleting config file.

Tim S.
« Last Edit: July 07, 2011, 03:55:09 am by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline pabon

  • Single posting newcomer
  • *
  • Posts: 5
Re: Linker Error!!!
« Reply #6 on: July 07, 2011, 04:27:16 am »
My intial global variable was set at: wx base = c:\wxWidgets-2.8.12. I only included the 'include' directory as one of my many steps to troubleshoot the link /LIBPATH error. I figured out why I'm getting the link /LIBPATH error. It has to do with my project build option linker-libraries setting that are being entered automatically by C::B. I'm using a unicode build of wxWigets. C::B had the link libraries setting like so:

link libraries
     are             should be
   wxmswd          wxmsw28ud
   wxbased          wxbase28ud
    etc..                etc..

I am now getting alot of:
 TutorialMain.obj||error LNK2019: unresolved external symbol "void __cdecl wxOnAssert(char const *,int,char const *,char const *,char const *)" (?wxOnAssert@@YAXPBDH000@Z) referenced in function "public: __thiscall wxStringBase::wxStringBase(class wxStringBase const &)" (??0wxStringBase@@QAE@ABV0@@Z)|
errors. I'm going to follow your suggestion and rename my default.conf file and see if I can reconfigure c::b.

Thanks for your help Tim.

Pabon

Offline pabon

  • Single posting newcomer
  • *
  • Posts: 5
Re: Linker Error!!!
« Reply #7 on: July 07, 2011, 06:39:03 pm »
SUCCESS!! Finally.

For whatever reason, on my first attempt to set the wx global variable, C::B would not accept my location for wxwidgets (which was valid). And the wizard would prompt me to enter it again. In both cases I used the browse button in the project wizard to set the variable. On the second attempt in would accept it, but would put the literal directory string in the wizards wx variable text block, as opposed to referring to $(#wx).

And for some reason with the literal directory set for the wx variable, the project wizard would not display the configuration page that allows for the setting of the wxwidgets build configuration e.g.  static, monolithic, unicode, etc. Once I had the ability to make those setting everthing worked. After changing the literal directory location with the $(#wx) variable string.


Thank you Tim.S for all your assistance.

pabon