Code::Blocks Forums

User forums => Help => Topic started by: Slider on December 04, 2005, 10:00:48 pm

Title: wxWidgets Project (cannot find -lwxmsw26) [Solved]
Post by: Slider on December 04, 2005, 10:00:48 pm
Hi, I hope someone can help me with this problem, I've read as much as I can about it, but can find no difinitive solution.

I'm using Code::Blocks 1.0 RC2 with the MinGW compiler - this works fine.

I've installed wxWidgets and compiled them by:
cd C:\wxWidgets\build\msw
mingw32-make -f makefile.gcc BUILD=release SHARED=1 MONOLITHIC=1 USE_XRC=1 UNICODE=0 VENDOR=cb
cd ..\..\contrib\build\stc
mingw32-make -f makefile.gcc BUILD=release SHARED=1 MONOLITHIC=1 USE_XRC=1 UNICODE=0 VENDOR=cb

I've created a new wxWidgets project using the supplied template, but when building I get the following error:
cannot find -lwxmsw26

I've checked the project "build options", under "link libraries" wxmsw26 is listed. (I understand using this type of link lib is best)

However, I can't find libwxmsw.a in C:\wxWidgets\lib\gcc_dll

Any ideas?
Title: Re: wxWidgets Project (cannot find -lwxmsw26)
Post by: Urxae on December 04, 2005, 11:49:31 pm
Two questions:
Title: Re: wxWidgets Project (cannot find -lwxmsw26)
Post by: Slider on December 05, 2005, 12:48:14 am
Hi,

I compiled version 2.6.2

As for the linker search path, I haven't added or changed anything manually. In Project>>Build Options>>Directories tab>>Linker tab I have:
$(WX_DIR)\lib\gcc_dll$(WX_CFG)
Title: Re: wxWidgets Project (cannot find -lwxmsw26)
Post by: sethjackson on December 05, 2005, 12:53:25 am
Hi,

I compiled version 2.6.2

As for the linker search path, I haven't added or changed anything manually. In Project>>Build Options>>Directories tab>>Linker tab I have:
$(WX_DIR)\lib\gcc_dll$(WX_CFG)

Add to linker.

$(WX_DIR)\lib\gcc_dll
$(WX_DIR)\lib\gcc_dll\msw

Add to compiler.

$(WX_DIR)\include
$(WX_DIR)\lib\gcc_dll
$(WX_DIR)\lib\gcc_dll\msw

And change your WX_DIR to "C:\wxWidgets".

Your compiler defines should have WXUSINGDLL or something like that. I use static can't remerber what that option was....
Title: Re: wxWidgets Project (cannot find -lwxmsw26)
Post by: Slider on December 05, 2005, 01:02:07 am
Hi,

I compiled version 2.6.2

As for the linker search path, I haven't added or changed anything manually. In Project>>Build Options>>Directories tab>>Linker tab I have:
$(WX_DIR)\lib\gcc_dll$(WX_CFG)

Add to linker.

$(WX_DIR)\lib\gcc_dll
$(WX_DIR)\lib\gcc_dll\msw

Add to compiler.

$(WX_DIR)\include
$(WX_DIR)\lib\gcc_dll
$(WX_DIR)\lib\gcc_dll\msw

And change your WX_DIR to "C:\wxWidgets".

Your compiler defines should have WXUSINGDLL or something like that. I use static can't remerber what that option was....

Thanks for the suggestion, I've followed what you said, but its still throwing up the same error.
Title: Re: wxWidgets Project (cannot find -lwxmsw26)
Post by: sethjackson on December 05, 2005, 01:05:56 am
Could you attach your project file (*.cbp)?
Title: Re: wxWidgets Project (cannot find -lwxmsw26)
Post by: Slider on December 05, 2005, 01:11:11 am
Could you attach your project file (*.cbp)?

Here it is, minus the corrections you suggested earlier.

<?xml version="1.0"?>
<!DOCTYPE CodeBlocks_project_file>
<CodeBlocks_project_file>
   <FileVersion major="1" minor="1"/>
   <Project>
      <Option title="wxWidgets application"/>
      <Option makefile="Makefile"/>
      <Option makefile_is_custom="0"/>
      <Option compiler="0"/>
      <Build>
         <Target title="default">
            <Option output="C:\test\wxWidgets.exe"/>
            <Option working_dir="."/>
            <Option object_output=".objs"/>
            <Option deps_output=".deps"/>
            <Option type="0"/>
            <Option compiler="0"/>
            <Option projectResourceIncludeDirsRelation="0"/>
         </Target>
         <Environment>
            <Variable name="WX_DIR" value="C:\wxWidgets"/>
            <Variable name="WX_CFG" value=""/>
         </Environment>
      </Build>
      <Compiler>
         <Add option="-pipe"/>
         <Add option="-mthreads"/>
         <Add option="-Winvalid-pch"/>
         <Add option="-include &quot;wx_pch.h&quot;"/>
         <Add option="-D__GNUWIN32__"/>
         <Add option="-D__WXMSW__"/>
         <Add option="-DWXUSINGDLL"/>
         <Add option="-DUSE_PCH"/>
         <Add directory="$(WX_DIR)\include"/>
         <Add directory="$(WX_DIR)\lib\gcc_dll$(WX_CFG)\msw"/>
         <Add directory="$(WX_DIR)\contrib\include"/>
      </Compiler>
      <ResourceCompiler>
         <Add directory="$(WX_DIR)\include"/>
      </ResourceCompiler>
      <Linker>
         <Add library="wxmsw26"/>
         <Add directory="$(WX_DIR)\lib\gcc_dll$(WX_CFG)"/>
      </Linker>
      <Unit filename="wx_pch.h">
         <Option compilerVar="CPP"/>
         <Option link="0"/>
         <Option weight="0"/>
         <Option target="default"/>
      </Unit>
   </Project>
</CodeBlocks_project_file>
Title: Re: wxWidgets Project (cannot find -lwxmsw26)
Post by: cyberkoa on December 05, 2005, 03:42:03 am
Could you attach your project file (*.cbp)?

Here it is, minus the corrections you suggested earlier.

<?xml version="1.0"?>
<!DOCTYPE CodeBlocks_project_file>
<CodeBlocks_project_file>
   <FileVersion major="1" minor="1"/>
   <Project>
      <Option title="wxWidgets application"/>
      <Option makefile="Makefile"/>
      <Option makefile_is_custom="0"/>
      <Option compiler="0"/>
      <Build>
         <Target title="default">
            <Option output="C:\test\wxWidgets.exe"/>
            <Option working_dir="."/>
            <Option object_output=".objs"/>
            <Option deps_output=".deps"/>
            <Option type="0"/>
            <Option compiler="0"/>
            <Option projectResourceIncludeDirsRelation="0"/>
         </Target>
         <Environment>
            <Variable name="WX_DIR" value="C:\wxWidgets"/>
            <Variable name="WX_CFG" value=""/>
         </Environment>
      </Build>
      <Compiler>
         <Add option="-pipe"/>
         <Add option="-mthreads"/>
         <Add option="-Winvalid-pch"/>
         <Add option="-include &quot;wx_pch.h&quot;"/>
         <Add option="-D__GNUWIN32__"/>
         <Add option="-D__WXMSW__"/>
         <Add option="-DWXUSINGDLL"/>
         <Add option="-DUSE_PCH"/>
         <Add directory="$(WX_DIR)\include"/>
         <Add directory="$(WX_DIR)\lib\gcc_dll$(WX_CFG)\msw"/>
         <Add directory="$(WX_DIR)\contrib\include"/>
      </Compiler>
      <ResourceCompiler>
         <Add directory="$(WX_DIR)\include"/>
      </ResourceCompiler>
      <Linker>
         <Add library="wxmsw26"/>
         <Add directory="$(WX_DIR)\lib\gcc_dll$(WX_CFG)"/>
      </Linker>
      <Unit filename="wx_pch.h">
         <Option compilerVar="CPP"/>
         <Option link="0"/>
         <Option weight="0"/>
         <Option target="default"/>
      </Unit>
   </Project>
</CodeBlocks_project_file>

It seems like you still have not defined WX_DIR...

Go to Project > Build Options > Custom variables  , Add a variable "WX_DIR" (without quotes), value as "C:\wxWidgets " (without quotes) , it should work now :)
Title: Re: wxWidgets Project (cannot find -lwxmsw26)
Post by: Slider on December 05, 2005, 04:06:29 pm
WX_DIR is defined, according to the cbp file above:
...
<Variable name="WX_DIR" value="C:\wxWidgets"/>
...
Title: Re: wxWidgets Project (cannot find -lwxmsw26)
Post by: cyberkoa on December 05, 2005, 05:29:11 pm
WX_DIR is defined, according to the cbp file above:
...
<Variable name="WX_DIR" value="C:\wxWidgets"/>
...
:oops: I use the search function to find in your .cbp file seems like I missed out ..

anyway , did you find your any library files under WX_DIR\lib\gcc_dll\  ? if not , try to search under WX_DIR with the file name wxmsw*  see where it is . If cannot be found , maybe your compilation of wxwidgets is not successful.


Title: Re: wxWidgets Project (cannot find -lwxmsw26)
Post by: Slider on December 05, 2005, 05:58:53 pm
When searching for wxmsw* nothing was found.

The follwing files are present in \lib\gcc_dll:

libwxexpat.a, libwxjpeg.a, libwxpng.a, libwxregex.a, libwxtiff.a, libwxzlib.a

The problem is really starting to annoy me. Thanks for your help.
Title: Re: wxWidgets Project (cannot find -lwxmsw26)
Post by: rickg22 on December 05, 2005, 06:33:24 pm
Just copy your libwxmsw26.a to that directory. It should be there around somewhere... search for lib*wx*.a:

Code
C:\> CD \wxWidgets
C:\wxWidgets> DIR lib*wx*.a /s /b

And tell us what you find.
Title: Re: wxWidgets Project (cannot find -lwxmsw26)
Post by: Slider on December 05, 2005, 06:41:19 pm
No libwxmsw26.a was found in c:\wxWidgets, has something gone wrong when I compiled wxWidgets?
Title: Re: wxWidgets Project (cannot find -lwxmsw26)
Post by: mandrav on December 05, 2005, 06:47:34 pm
When searching for wxmsw* nothing was found.

...

The problem is really starting to annoy me. Thanks for your help.

Check your wxWidgets build. If you don't have the wxMSW DLL (and import library) already built, how do you expect it to work?  :shock:
Title: Re: wxWidgets Project (cannot find -lwxmsw26)
Post by: Slider on December 05, 2005, 06:53:02 pm
I followed the instructions using mingw32-make to compile the libraries, no errors were encountered. Part of the problem is there are no definitive instructions for getting wxWidgets working with Code::Blocks - the Wiki says something different to the wxWidgets "instructions" posted in this forum.
Title: Re: wxWidgets Project (cannot find -lwxmsw26)
Post by: Slider on December 05, 2005, 07:07:57 pm
ok, I've gone through the build again, but still no libwxmsw26.a is created anywhere.
Title: Re: wxWidgets Project (cannot find -lwxmsw26)
Post by: cyberkoa on December 06, 2005, 08:40:06 pm
very strange ... a question , do you have  wxmsw26_gcc_cb.dll ?


One of the possibility may due to non-default wxwidgets installation path.

Try to add an OS environment variable in your windows  (My computer right click>  properties > Advanced > Environment variable  , it may a bit different win2k & winxp )

set WX_DIR as c:\wxwidgets

Recompile wxwidgets (do a make clean before recompile)
Title: Re: wxWidgets Project (cannot find -lwxmsw26)
Post by: Slider on December 06, 2005, 10:22:42 pm
Thanks for your suggestion cyberkoa, turns out it there was no environment variable for the MinGW compiler, putting it in place solved the problem. Thanks.
Title: Re: wxWidgets Project (cannot find -lwxmsw26) [Solved]
Post by: sviten on December 16, 2005, 04:11:52 pm
Can you be more specific with your fix please?  I'm having the same issue.  What particular environment variable did you set?
Title: Re: wxWidgets Project (cannot find -lwxmsw26) [Solved]
Post by: 280Z28 on December 16, 2005, 04:13:34 pm
Can you be more specific with your fix please?  I'm having the same issue.  What particular environment variable did you set?

Yeah a bunch of people are having trouble with this still. I'll make a new thread today in the compilation forum and make it obvious, like "How-To: Compile svn head C::B in Unicode configuration"
Title: Re: wxWidgets Project (cannot find -lwxmsw26) [Solved]
Post by: sviten on December 16, 2005, 05:02:07 pm
Yeah a bunch of people are having trouble with this still. I'll make a new thread today in the compilation forum and make it obvious, like "How-To: Compile svn head C::B in Unicode configuration"

That's great and I appreciate it but I think this thread is about compiling/linking other projects, not C::B.
Title: Re: wxWidgets Project (cannot find -lwxmsw26) [Solved]
Post by: sviten on December 16, 2005, 05:59:36 pm
OK, I found my issue.  My issue was I could get it to compile correctly but it would not run ( as in "Process terminated with status 1" ).  My solution was to copy the dll file into the path.  To keep things clean, I copied it into the project folder.
Title: Re: wxWidgets Project (cannot find -lwxmsw26) [Solved]
Post by: Michael on December 16, 2005, 06:03:45 pm
My solution was to copy the dll file into the path.  To keep things clean, I copied it into the project folder.

You can also add the path of the dll(s) directory in the system path (environmental variable). This is useful if other applications used the same dll(s).

Michael