Author Topic: windows build error  (Read 1501 times)

Offline codelighter

  • Multiple posting newcomer
  • *
  • Posts: 10
windows build error
« on: April 04, 2018, 11:11:03 am »
-------------- Build: Debug in demo (compiler: GNU GCC Compiler)---------------

mingw32-g++.exe -LC:\wxWidgets\lib\gcc_lib -LC:\wxWidgets -o bin\Debug\demo.exe obj\Debug\demoApp.o obj\Debug\demoMain.o  obj\Debug\resource.res -mthreads  -lwxmsw31ud_xrc -lwxmsw31ud_aui -lwxbase31ud_net -lwxmsw31ud_gl -lwxbase31ud_xml -lwxmsw31ud_adv -lwxmsw31ud_html -lwxmsw31ud_core -lwxbase31ud -lwxpngd -lwxjpegd -lwxtiffd -lwxzlibd -lwxregexud -lwxexpatd -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -luuid -lcomctl32 -lwsock32 -lodbc32 -lshlwapi -lversion -lC:\wxWidgets -mwindows
C:/code_blocks/MinGW/bin/../lib/gcc/mingw32/5.1.0/../../../../mingw32/bin/ld.exe: cannot find -lC:\wxWidgets
collect2.exe: error: ld returned 1 exit status
Process terminated with status 1 (0 minute(s), 2 second(s))
2 error(s), 0 warning(s) (0 minute(s), 2 second(s))

 ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D
Above errors appear when I want to build a wxWidgets 3.1.1 basic dialog-based project in Code::Blocks using mingw23-g++.exe, I wanna to know how to fix it. Thanks!

Online stahta01

  • Lives here!
  • ****
  • Posts: 6282
    • My Best Post
Re: windows build error
« Reply #1 on: April 04, 2018, 11:26:50 am »
Remove "C:\wxWidgets" from the library list where you added it.

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

Offline codelighter

  • Multiple posting newcomer
  • *
  • Posts: 10
Re: windows build error
« Reply #2 on: April 04, 2018, 11:36:33 am »
Remove "C:\wxWidgets" from the library list where you added it.

Tim S.

I checked many config and settings,  still can't find where the library list locate? can you show me more details?

Offline codelighter

  • Multiple posting newcomer
  • *
  • Posts: 10
Re: windows build error
« Reply #3 on: April 04, 2018, 11:43:17 am »
Remove "C:\wxWidgets" from the library list where you added it.

Tim S.

following is the linker screenshot, the C:\wxWidgets can't be found in the dialog, but the debugger still run error.

Online stahta01

  • Lives here!
  • ****
  • Posts: 6282
    • My Best Post
Re: windows build error
« Reply #4 on: April 04, 2018, 11:47:38 am »
Check under the project setting by clicking on demo in the left hand pane.

Edit: Also, use the scroll down arrow to see if it is below the ones listed in the screen shot for the debug target.

Tim S.
« Last Edit: April 04, 2018, 11:50:14 am by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Testing, compiling CB Trunk against wxWidgets 3.0.2.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline codelighter

  • Multiple posting newcomer
  • *
  • Posts: 10
Re: windows build error
« Reply #5 on: April 04, 2018, 12:00:29 pm »
Check under the project setting by clicking on demo in the left hand pane.

Edit: Also, use the scroll down arrow to see if it is below the ones listed in the screen shot for the debug target.

Tim S.


I have checked the linker setting and other tabs many times, still can't find why the IDE output the wrong link options.

Offline codelighter

  • Multiple posting newcomer
  • *
  • Posts: 10
Re: windows build error
« Reply #6 on: April 04, 2018, 12:02:46 pm »
This is the only place I add C:\wxWidgets in IDE, but this is the correct way.

Online stahta01

  • Lives here!
  • ****
  • Posts: 6282
    • My Best Post
Re: windows build error
« Reply #7 on: April 04, 2018, 12:07:54 pm »
Did you check the project instead of the target settings?
Edit: Till you post a screen shot of the project settings, I will believe you have failed to check them!

Did you check the global compiler linker settings?

Tim S.
« Last Edit: April 04, 2018, 12:11:49 pm by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Testing, compiling CB Trunk against wxWidgets 3.0.2.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline codelighter

  • Multiple posting newcomer
  • *
  • Posts: 10
Re: windows build error
« Reply #8 on: April 04, 2018, 12:18:36 pm »
Did you check the project instead of the target settings?
Edit: Till you post a screen shot of the project settings, I will believe you have failed to check them!

Did you check the global compiler linker settings?

Tim S.

You are RIGHT! , I remove the $(#wx) item in the global linker setting. afterwards I encounter a new problem when building. How to solve it?

Online stahta01

  • Lives here!
  • ****
  • Posts: 6282
    • My Best Post
Re: windows build error
« Reply #9 on: April 04, 2018, 12:21:59 pm »
You need to add the libraries needed to fix the linking errors.
Edit: "Undefined Reference" errors are linking errors.
Note: The order of libraries matter for some compilers.

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

Offline codelighter

  • Multiple posting newcomer
  • *
  • Posts: 10
Re: windows build error
« Reply #10 on: April 04, 2018, 12:29:37 pm »
You need to add the libraries needed to fix the linking errors.
Note: The order of libraries matter for some compilers.

Tim S.

I don't well know which libraries these functions own to , I build the newest wxWidget 3.1.1 source code with following command lines.   Advices about wxWidget 3.1.1 build process on windows platform would be appreciated.
Code: [Select]
@echo off 
cd build/msw 
title Compile wxWidgets 
echo Start Compile ... 
echo --------------------------------------------------------------------- 
  
::echo Clean Env
::mingw32-make -f makefile.gcc clean

echo Compile Release Version
::SHARED=0, Static Link Library. SHARED=1, Dynamic Link Library.
::MONOLITHIC=0, Multiple Widgets. MONOLITHIC=1, Single Widgets.
::UNICODE=0, Not Support Unicode. Unicode=1, Support Unicode.
mingw32-make -f makefile.gcc BUILD=release SHARED=0 MONOLITHIC=0 UNICODE=1  .
mingw32-make -f makefile.gcc BUILD=release SHARED=1 MONOLITHIC=0 UNICODE=1 

echo Compile Debug Version
mingw32-make -f makefile.gcc BUILD=debug SHARED=0 MONOLITHIC=0 UNICODE=1 
mingw32-make -f makefile.gcc BUILD=debug SHARED=1 MONOLITHIC=0 UNICODE=1 

echo --------------------------------------------------------------------- 
echo Compile Succeed.
pause 

Offline codelighter

  • Multiple posting newcomer
  • *
  • Posts: 10
Re: windows build error
« Reply #11 on: April 04, 2018, 12:31:03 pm »
The build process result is succeed. but some packages always missing.

Online stahta01

  • Lives here!
  • ****
  • Posts: 6282
    • My Best Post
Re: windows build error
« Reply #12 on: April 04, 2018, 12:51:04 pm »
Till you learn to use code tags there is no way for me to help you without a lot of work on my part.

And, since the problem is likely Windows libraries are missing the Linux devs are not likely to help you.

Link to how to report a problem. It includes some paste to forum info.
http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28general%29#Q:_How_do_I_report_a_compilation_problem_on_the_forums.3F

Tim S.


C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Testing, compiling CB Trunk against wxWidgets 3.0.2.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Online stahta01

  • Lives here!
  • ****
  • Posts: 6282
    • My Best Post
Re: windows build error
« Reply #13 on: April 04, 2018, 12:54:07 pm »
You are likely missing one of these lib statements

Code: [Select]

-lrpcrt4 -loleaut32 -lole32 -luuid -lwinspool -lwinmm -lshell32 -lcomctl32 -lcomdlg32 -ladvapi32 -lwsock32 -lgdi32 -loleacc

The last one tends to match the errors I saw the most.

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

Offline codelighter

  • Multiple posting newcomer
  • *
  • Posts: 10
Re: windows build error
« Reply #14 on: April 06, 2018, 06:09:43 am »
You are likely missing one of these lib statements

Code: [Select]

-lrpcrt4 -loleaut32 -lole32 -luuid -lwinspool -lwinmm -lshell32 -lcomctl32 -lcomdlg32 -ladvapi32 -lwsock32 -lgdi32 -loleacc

The last one tends to match the errors I saw the most.

Tim S.

Thanks very much. I would try it.

Offline codelighter

  • Multiple posting newcomer
  • *
  • Posts: 10
Re: windows build error
« Reply #15 on: April 06, 2018, 12:38:41 pm »
I have found a good way to set up wxWidgets3.1.1 develop environment in CodeBlocks 17.12 [windows ONLY].
guidestep notes
7.1 select which version of wxWidgets we will use, here we select wxWidgets3.1.x
7.2give a name to our project and set its location. You can config any path in your desire
7.3set author information, you can ignore this step
7.4select Dialog based or Frame Based Progamming Model, it depends you need,here for simplicity, we select Dialog Based
7.5set wxWidgets path, if you have already set global variable wx in CodeBlocks Setting tab, just fill $(#wx) ,otherwise fill the full wxWidgets installed path
7.6select compiler, let it as default
7.7make sure Use WxWidgets DLL Enable UnicodeConfigure Advanced Options three options is selected
7.7make sure two GUI Mode Application is selected
7.8first select all items, then unselect wxDBGrid,wxOdbc,wxQa three items

attachment is my successful screenshot.