Author Topic: undefined reference to '__imp__Z...' etc.  (Read 5859 times)

Offline spatz123

  • Single posting newcomer
  • *
  • Posts: 2
undefined reference to '__imp__Z...' etc.
« on: October 18, 2010, 02:31:49 pm »
I'm trying to write a my first small console application with Code::Blocks, consisting of two files, one of which I want to be able to reuse in other projects. I can compile it but not link:

My settings are as follows:

- Settings -> Compiler and debugger -> Linker settings -> Link libraries: C:\Programme\CodeBlocks\SourceCode\Libraries\wxWidgets2.8\lib\gcc_lib\libwxmsw28u.a
- Settings -> Compiler and debugger -> Linker settings -> Link libraries: C:\Programme\CodeBlocks\SourceCode\Libraries\wxWidgets2.8\lib\gcc_lib\libwxmswbase28u.a
- Settings -> Compiler and debugger -> Search directories -> Compiler: C:\Programme\CodeBlocks\SourceCode\Libraries\wxWidgets2.8\lib\gcc_lib\mswu
- Settings -> Compiler and debugger -> Search directories -> Compiler: C:\Programme\CodeBlocks\SourceCode\Libraries\wxWidgets2.8\include
- Settings -> Compiler and debugger -> Search directories -> Compiler: C:\Programme\CodeBlocks\SourceCode\Libraries\wxWidgets2.8\contrib\include
- Settings -> Compiler and debugger -> Search directories -> Linker: C:\Programme\CodeBlocks\SourceCode\Libraries\wxWidgets2.8\lib\gcc_lib
- Settings -> Compiler and debugger -> Search directories -> Resource Compiler: C:\Programme\CodeBlocks\SourceCode\Libraries\wxWidgets2.8\lib\gcc_lib\mswu


Code::Blocks 10.05 with MinGW and wxPack on Win XP

From the build log:

mingw32-g++.exe -LC:\Programme\CodeBlocks\SourceCode\Libraries\wxWidgets2.8\lib\gcc_lib  -o bin\Debug\Application_MDT.exe obj\Debug\tutils.o obj\Debug\main.o    C:\Programme\CodeBlocks\SourceCode\Libraries\wxWidgets2.8\lib\gcc_lib\libwxmsw28u.a C:\Programme\CodeBlocks\SourceCode\Libraries\wxWidgets2.8\lib\gcc_lib\libwxmsw28u.a C:\Programme\CodeBlocks\SourceCode\Libraries\wxWidgets2.8\lib\gcc_lib\libwxbase28u.a
obj\Debug\tutils.o:C:/develop/idu_neu/Application_MDT/tutils.cpp:18: undefined reference to `_imp___ZN19wxStandardPathsBase3GetEv'
obj\Debug\tutils.o:C:/develop/idu_neu/Application_MDT/tutils.cpp:19: undefined reference to `_imp___ZplRK8wxStringPKw'
obj\Debug\tutils.o:C:/develop/idu_neu/Application_MDT/tutils.cpp:19: undefined reference to `_imp___ZN10wxFileName10FileExistsERK8wxString'
obj\Debug\tutils.o:C:/Programme/CodeBlocks/SourceCode/Libraries/wxWidgets2.8/include/wx/string.h:270: undefined reference to `_imp__wxEmptyString'
obj\Debug\tutils.o: In function `wxStringBase':
C:/Programme/CodeBlocks/SourceCode/Libraries/wxWidgets2.8/include/wx/string.h:368: undefined reference to `_imp___ZN12wxStringBase4nposE'
C:/Programme/CodeBlocks/SourceCode/Libraries/wxWidgets2.8/include/wx/string.h:368: undefined reference to `_imp___ZN12wxStringBase8InitWithEPKwjj'
obj\Debug\main.o: In function `main':
C:/develop/idu_neu/Application_MDT/main.cpp:13: undefined reference to `_imp___ZplRK8wxStringPKw'
C:/develop/idu_neu/Application_MDT/main.cpp:13: undefined reference to `_imp___ZN12wxTextBuffer4OpenERK8wxStringRK8wxMBConv'
obj\Debug\main.o: In function `wxMBConv':
C:/Programme/CodeBlocks/SourceCode/Libraries/wxWidgets2.8/include/wx/strconv.h:53: undefined reference to `_imp___ZTV8wxMBConv'
obj\Debug\main.o:C:/Programme/CodeBlocks/SourceCode/Libraries/wxWidgets2.8/include/wx/string.h:660: undefined reference to `_imp___ZN12wxStringBaseaSERKS_'
...


My includes are:

#include "tutils.h"
#include <wx/string.h>
#include <wx/stdpaths.h>
#include <wx/filename.h>
 

My #defines (from Settings -> Global compiler settings -> Compiler settings -> #defines):

__GNUWIN32__
__WXMSW__
wxUSE_UNICODE


and lines 18 and 19 (referred to in the errors) are:

Code
  
  wxString path = wxStandardPaths::Get().GetExecutablePath();
  if (wxFileName::FileExists(path + _T("test.conf")))


I've already tried various tips found on the Web (like I mustn't use both gcc_lib and gcc_dll simultanesouly, and adding libwxmswbase28u.a to the link libraries) but none has changed anything so far. What else do I need to do?

TIA.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: undefined reference to '__imp__Z...' etc.
« Reply #1 on: October 18, 2010, 03:36:31 pm »
- Settings -> Compiler and debugger -> Linker settings -> Link libraries: C:\Programme\CodeBlocks\SourceCode\Libraries\wxWidgets2.8\lib\gcc_lib\libwxmsw28u.a
- Settings -> Compiler and debugger -> Linker settings -> Link libraries: C:\Programme\CodeBlocks\SourceCode\Libraries\wxWidgets2.8\lib\gcc_lib\libwxmswbase28u.a
Enter only wxmsw28u and wxmswbase28u. Also, I think wxmswbase should be entered first. Try reordering these two.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: undefined reference to '__imp__Z...' etc.
« Reply #2 on: October 19, 2010, 10:27:21 am »
And the solution was?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline spatz123

  • Single posting newcomer
  • *
  • Posts: 2
Re: undefined reference to '__imp__Z...' etc.
« Reply #3 on: October 19, 2010, 10:37:38 pm »
I thought what you had written was the solution, i.e. changing the order and removing the .a. This indeed got rid of my original error message but I now have two new ones in the build log (but they're not classified as errors by CB) when I click on either "build" or "build and run":

"mingw32-g++.exe: C:\Programme\CodeBlocks\SourceCode\Libraries\wxWidgets2.8\lib\gcc_lib\libwxbase28u: No such file or directory
mingw32-g++.exe: C:\Programme\CodeBlocks\SourceCode\Libraries\wxWidgets2.8\lib\gcc_lib\libwxmsw28u: No such file or directory
Process terminated with status 1 (0 minutes, 0 seconds)
0 errors, 0 warnings"

So if there are no errors and no warnings, why does it give me these messages, and why doesn't it run? And what is status 1?

Apart from that, I also keep getting a message "It seems that this project has not been built yet. Do you want to build it now?" I've set it up as a C++ project, and all fields in the toolchain path are filled in (I used auto-detect and also checked manually that these files do indeed exist).