简体   繁体   English

wxSmith和Code :: Blocks构建错误

[英]wxSmith and Code::Blocks build error

I recently started to work on GUI using wxSmith on Code::Blocks 10.05, and when I run the project, I haven't written any code yet, just the OnClose function, and I when I build and run my project, I get 4 errors, cannot find -lwxmsw28d_core , cannot find -lwxbase28d , cannot find -lwxpngd , and cannot find -lwxzlibd . 我最近开始在代码:: Blocks 10.05上使用wxSmith在GUI上工作,当我运行该项目时,我还没有编写任何代码,只是OnClose函数,而当我构建并运行我的项目时,我得到了4错误, cannot find -lwxmsw28d_corecannot find -lwxbase28dcannot find -lwxpngdcannot find -lwxzlibd The build log is: 构建日志为:

-------------- Build: Debug in gui-test ---------------

Compiling: gui_testMain.cpp
Linking executable: bin\Debug\gui-test.exe
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/4.7.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:\SourceCode\Libraries\wxWidgets2.8\lib\gcc_lib/libwxmsw28d_core.a when searching for -lwxmsw28d_core
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/4.7.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:\SourceCode\Libraries\wxWidgets2.8\lib\gcc_lib\libwxmsw28d_core.a when searching for -lwxmsw28d_core
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/4.7.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:\SourceCode\Libraries\wxWidgets2.8\lib\gcc_lib/libwxmsw28d_core.a when searching for -lwxmsw28d_core
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/4.7.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lwxmsw28d_core
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/4.7.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:\SourceCode\Libraries\wxWidgets2.8\lib\gcc_lib/libwxbase28d.a when searching for -lwxbase28d
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/4.7.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:\SourceCode\Libraries\wxWidgets2.8\lib\gcc_lib\libwxbase28d.a when searching for -lwxbase28d
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/4.7.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:\SourceCode\Libraries\wxWidgets2.8\lib\gcc_lib/libwxbase28d.a when searching for -lwxbase28d
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/4.7.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lwxbase28d
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/4.7.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:\SourceCode\Libraries\wxWidgets2.8\lib\gcc_lib/libwxpngd.a when searching for -lwxpngd
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/4.7.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:\SourceCode\Libraries\wxWidgets2.8\lib\gcc_lib\libwxpngd.a when searching for -lwxpngd
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/4.7.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:\SourceCode\Libraries\wxWidgets2.8\lib\gcc_lib/libwxpngd.a when searching for -lwxpngd
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/4.7.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lwxpngd
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/4.7.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:\SourceCode\Libraries\wxWidgets2.8\lib\gcc_lib/libwxzlibd.a when searching for -lwxzlibd
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/4.7.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:\SourceCode\Libraries\wxWidgets2.8\lib\gcc_lib\libwxzlibd.a when searching for -lwxzlibd
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/4.7.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:\SourceCode\Libraries\wxWidgets2.8\lib\gcc_lib/libwxzlibd.a when searching for -lwxzlibd
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/4.7.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lwxzlibd
collect2.exe: error: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 1 seconds)
4 errors, 0 warnings

What could be giving me the error? 是什么让我出错了? I'm using Code::Blocks on Windows. 我在Windows上使用Code :: Blocks。 And I'm doing as a tutorial what this link is doing wxSmith Tutorial - Code::Blocks Wiki 我正在做一个教程,这个链接在做什么wxSmith教程-Code :: Blocks Wiki

NOTE: If it helps, I installed wxWidgets from wxPack, and in Code::Blocks, I made a Global Variable using the Global Variable Editor, where the base field has C:\\SourceCode\\Libraries\\wxWidgets2.8 , include field has C:\\SourceCode\\Libraries\\wxWidgets2.8\\include , and lib field has C:\\SourceCode\\Libraries\\wxWidgets2.8\\lib . 注意:如果有帮助,我从wxPack安装了wxWidgets,并在Code :: Blocks中,使用全局变量编辑器创建了一个全局变量,其中的基本字段为C:\\SourceCode\\Libraries\\wxWidgets2.8 ,包含字段为C:\\SourceCode\\Libraries\\wxWidgets2.8\\include ,并且lib字段具有C:\\SourceCode\\Libraries\\wxWidgets2.8\\lib The rest of the fields are empty, like the obj (i couldnt find obj folder), cflags, lflags, and user-defined fields are empty. 其余字段为空,例如obj(我找不到obj文件夹),cflags,lflags和用户定义的字段为空。

"Incompatible" almost certainly means that the library is a 32 bit file and you're using 64 bit compiler. “不兼容”几乎可以肯定意味着该库是一个32位文件,而您正在使用64位编译器。 Run file on both the library and one of the object files generated during your build from MinGW command line to confirm this. 在库中运行file ,并在从MinGW命令行构建时生成的目标文件之一上运行file ,以确认这一点。

If this is correct, the solution would be to add -m32 option to the compiler/linker command lines if they really generate 64 bit code by default. 如果正确的话,解决方案是在编译器/链接器命令行默认情况下确实生成64位代码的情况下在编译器/链接器命令行中添加-m32选项。 Or maybe just get a 32 bit version of the compiler. 或者,也许只是获得32位版本的编译器。

Looks as if you did not compile the correct Debug version of wxWidgets. 好像您没有编译正确的wxWidgets Debug版本。

Look at your ...\\wxWidgets\\build\\msw folder, is there a folder like 查看您的... \\ wxWidgets \\ build \\ msw文件夹,是否有类似的文件夹

  • gc_mwsud (unicode debug) gc_mwsud(Unicode调试)
  • gc_mswuddll (unicode debug shared) gc_mswuddll(共享unicode调试)

and in your case a folder 还有你的文件夹

  • gcc_mswd (debug) gcc_mswd(调试)
  • gcc_mswddll (debug shared) gcc_mswddll(共享调试)

EDIT 编辑

Only for your special case 仅针对您的特殊情况

go to x:\\wxWidgets\\build\\msw\\ ( x == your drive) 转到x:\\ wxWidgets \\ build \\ msw \\ (x ==您的驱动器)

change your x:\\wxWidgets\\build\\msw\\config.gcc like 像这样更改x:\\ wxWidgets \\ build \\ msw \\ config.gcc

....

# C compiler 
CC = gcc

# C++ compiler 
CXX = g++
....

# What type of library to build? [0,1]
SHARED = 0
....

# Compile Unicode build of wxWidgets? [0,1]
UNICODE = 0
....

# Type of compiled binaries [debug,release]
BUILD ?= debug
....

# Multiple libraries or single huge monolithic one? [0,1]
MONOLITHIC = 0

make with command. 用命令制作。 ONLY for your special case !! 只为您的特殊情况!

x:\\wxWidgets\\build\\msw>mingw32-make -f makefile.gcc x:\\ wxWidgets \\ build \\ msw> mingw32-make -f makefile.gcc

The normal way for the officially-supported Code::Blocks is 官方支持的Code :: Blocks的正常方式是

clean up the source: 清理源:

mingw32-make -f makefile.gcc MONOLITHIC=1 SHARED=1 UNICODE=1 BUILD=debug clean mingw32-make -f makefile.gcc MONOLITHIC = 1 SHARED = 1 UNICODE = 1 BUILD = debug clean

NOTE: Make sure you use exactly the same options for this step and for the build step below. 注意:确保在此步骤和下面的构建步骤中使用完全相同的选项。 The clean target uses these variables and only cleans the specified version of the generated object and library files. 清理目标使用这些变量,并且仅清理生成的对象和库文件的指定版本。 (It will not clean the intended files if these variables are not identical.) (如果这些变量不相同,它将不会清除目标文件。)

NOTE: If you still have problems with compiling after cleaning, you could try to manually remove the gcc_mswd directory under the build\\msw directory. 注意:如果在清理后仍然无法编译,则可以尝试手动删除build \\ msw目录下的gcc_mswd目录。 This directory is the place where the object files are stored. 此目录是存储目标文件的位置。

When everything is clean you can start compiling wxWidgets: 一切正常后,您可以开始编译wxWidgets了:

mingw32-make -f makefile.gcc MONOLITHIC=1 SHARED=1 UNICODE=1 BUILD=debug mingw32-make -f makefile.gcc MONOLITHIC = 1 SHARED = 1 UNICODE = 1 BUILD = debug

NOTE: These options are the officially-supported Code::Blocks options. 注意:这些选项是官方支持的Code :: Blocks选项。 If you want another version of wxWidgets (debug or non-Unicode) you still have to make sure you build a MONOLITHIC version (one big DLL) for linking Code::Blocks. 如果需要wxWidgets的另一个版本(调试或非Unicode),则仍然必须确保构建用于链接Code :: Blocks的MONOLITHIC版本(一个大DLL)。

Patience. 忍耐。 This step takes time. 此步骤需要时间。 Make sure there was no compilation error before you continue. 在继续之前,请确保没有编译错误。

http://wiki.codeblocks.org/index.php?title=Compiling_wxWidgets_2.8.6_to_develop_Code::Blocks_%28MSW%29 http://wiki.codeblocks.org/index.php?title=Compiling_wxWidgets_2.8.6_to_develop_Code::Blocks_%28MSW%29

while making a new project just check the option that wxwidget is built as a monolithic library with use wxwidget DLL option.! 在创建新项目时,只需检查使用wxwidget DLL选项将wxwidget构建为整体库的选项即可! if already created project just add linker settings and compiler settings of the project (properties) 如果已经创建了项目,则只需添加项目的链接器设置和编译器设置(属性)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM