User forums > Help

Problem Linking Gcc : A new wxwidget project

(1/5) > >>

cyberkoa:
I am new to wxwidget and  development  on framework  and gcc.

I try to create a new project under code block using the Menu > Project New Project , I select wxwidget program with static library and separate app and frame source code.

I try to compile without touching any code , it failed. I add it the wxwidget's include path in the compiler , and it successfully compiled.

But , the linking process fail.


The error msg is
mingw32-g++.exe   -L"C:\\MinGW\\lib"  -o "C:\\gui\\wxWindows.exe"   -L"C:\\MinGW\\lib"  ".objs\\main.o" ".objs\\app.o"     -lstdc++ -lgcc -lgdi32 -lcomdlg32 -lodbc32 -lwsock32 -lwinspool -lwinmm -lshell32 -lcomctl32 -lctl3d32 -ladvapi32 -lopengl32 -lglu32 -lole32 -loleaut32 -luuid -lwxmsw242 -mwindows
C:\MinGW\bin\..\lib\gcc-lib\mingw32\3.2.3\..\..\..\..\mingw32\bin\ld.exe: cannot find -lwxmsw242
Process terminated with status 1 (0 minutes, 0 seconds)
0 errors, 0 warnings

and later I found the wxmsw242.dll under CodeBlock's program  path , I added the CodeBlock's program path in the Link path , but now it give me another error.



Project   : wxWindows application
Compiler  : GNU GCC Compiler (called directly)
Directory : C:\gui\
--------------------------------------------------------------------------------
mingw32-g++.exe   -L"C:\\MinGW\\lib" -L"C:\\Program Files\\CodeBlocks"  -o "C:\\gui\\wxWindows.exe"   -L"C:\\MinGW\\lib" -L"C:\\Program Files\\CodeBlocks"  ".objs\\main.o" ".objs\\app.o"     -lstdc++ -lgcc -lgdi32 -lcomdlg32 -lodbc32 -lwsock32 -lwinspool -lwinmm -lshell32 -lcomctl32 -lctl3d32 -ladvapi32 -lopengl32 -lglu32 -lole32 -loleaut32 -luuid -lwxmsw242 -mwindows
Info: resolving _wxFrameNameStr by linking to __imp__wxFrameNameStr (auto-import)
C:\\MinGW\\lib/libmingw32.a(main.o)(.text+0x97):main.c: undefined reference to `WinMain@16'
Info: resolving _wxDefaultSize by linking to __imp__wxDefaultSize (auto-import)
Info: resolving _wxDefaultPosition by linking to __imp__wxDefaultPosition (auto-import)
Info: resolving _wxEVT_COMMAND_MENU_SELECTED by linking to __imp__wxEVT_COMMAND_MENU_SELECTED (auto-import)
Info: resolving _wxEVT_NULL by linking to __imp__wxEVT_NULL (auto-import)
Info: resolving __ZN7wxFrame15sm_classwxFrameE by linking to __imp___ZN7wxFrame15sm_classwxFrameE (auto-import)
Info: resolving __ZN6wxMenu14sm_classwxMenuE by linking to __imp___ZN6wxMenu14sm_classwxMenuE (auto-import)
Info: resolving _wxEmptyString by linking to __imp__wxEmptyString (auto-import)
Info: resolving __ZN12wxEvtHandler20sm_classwxEvtHandlerE by linking to __imp___ZN12wxEvtHandler20sm_classwxEvtHandlerE (auto-import)
Info: resolving __ZN8wxObject16sm_classwxObjectE by linking to __imp___ZN8wxObject16sm_classwxObjectE (auto-import)
Info: resolving _wxTheApp by linking to __imp__wxTheApp (auto-import)
Info: resolving _wxTopLevelWindows by linking to __imp__wxTopLevelWindows (auto-import)
Info: resolving _wxNullIcon by linking to __imp__wxNullIcon (auto-import)
Info: resolving __ZN5wxApp13sm_classwxAppE by linking to __imp___ZN5wxApp13sm_classwxAppE (auto-import)
Info: resolving __ZN9wxAppBase11m_appInitFnE by linking to __imp___ZN9wxAppBase11m_appInitFnE (auto-import)
Info: resolving __ZN6wxIcon14sm_classwxIconE by linking to __imp___ZN6wxIcon14sm_classwxIconE (auto-import)
Info: resolving __ZN11wxGDIObject19sm_classwxGDIObjectE by linking to __imp___ZN11wxGDIObject19sm_classwxGDIObjectE (auto-import)
Process terminated with status 1 (0 minutes, 1 seconds)
1 errors, 0 warnings


This time I don't  know what had happened .
Anybody can help me ?

My platform : Windows 2000 Professinal
wx-widgets2.4.2

Anonymous:
Later  I have tried to create a new wx-widget again , but this time I use wxwinget DLL instead of  static library.

I manage to compile and link the program but when I run , it shows me that  DLL not found. I then copied the wxmsw242.dll to the program path.
and run the program . But  this time , a windows error shows (like those messege shown whenever a program goes hair-wire).

I have tried my best , please help me , thanks.

I do not want to see my adventure to wxwidget  stops here ...

mandrav:
Hi,

you need to have the wxWidgets development libraries and header files. I assume you don't, because you try to link with the dll. You have to link with a static library (in this case libwxmsw242.a).
You should download and build wxWidgets yourself. This will create the necessary files needed to build wxWidgets applications.
Maybe I 'll write a small article in the wiki about this process...

Don't give up :)
Yiannis.

Anonymous:
Thanks mandrav. I won't give up so easy  :D

I have the wxWidgets development libraries and header files, they are under c:\wxWindows-2.4.2 . However, I do not build them myself , I downloaded the  setup files and install , it should ok right ?

I try to link with DLL because from the following error message
C:\MinGW\bin\..\lib\gcc-lib\mingw32\3.2.3\..\..\..\..\mingw32\bin\ld.exe: cannot find -lwxmsw242
 
I try to Find file with named "wxmsw242" and I can only get wxmsw242.dll .
The file you mentioned "libwxmsw242.a" is not exist , but I found that it there are 2 files named "libwxmsw.a" under c:\wxWindows-2.4.2\lib\release and c:\wxWindows-2.4.2\lib\debug respectively.

I believe this is the static library you mentioned. Therefore,  I have tried a series of effort.

1. I try to add c:\wxWindows-2.4.2\lib\release in my Link Dirs .
I try to link again , but the same message prompt.

2. I renamed the libwxmsw.a to wxmsw242.a , and try to link again.
     Same problem.

3. I renamed the libwxmsw.a to wxmsw242 , and try to link again.
     Same problem.

4. I renamed the libwxmsw.a to libwxmsw242.a , and try to link again.
     Same problem.

5.  I copy the libwxmsw.a to C:\WINNT , and repeat the rename and link steps , still cannot solve the problem.


Now , I cannot think of other way .

My compiler Dirs setting is
C:\MinGW\include
c:\wxWindows-2.4.2\include


My Linker dirs setting is
C:\MinGW\lib
C:\wxWindows-2.4.2\lib\release

Any settings I have left out ?

I have tested a few IDE for wx-widget and finally I choose Code::Block , because it is fast , stable and configurable .  I believe after solving this problem , I will start to step into the open source development environment that I have dreamt for a few years.


--- Quote ---You should download and build wxWidgets yourself. This will create the necessary files needed to build wxWidgets applications.
Maybe I 'll write a small article in the wiki about this process...
--- End quote ---


After I solved this problem , I shall help to write a small article to help those who cannot make a new wxwidget project also :D

mandrav:

--- Quote ---The file you mentioned "libwxmsw242.a" is not exist , but I found that it there are 2 files named "libwxmsw.a" under c:\wxWindows-2.4.2\lib\release and c:\wxWindows-2.4.2\lib\debug respectively.

--- End quote ---

Add "c:\wxWindows-2.4.2\lib\release" to your linker dirs (or the debug version, whichever you prefer). Then, in the link libraries, edit the "wxmsw242" library and change it to "wxmsw".
That's all that's needed.

HTH,
Yiannis.

Navigation

[0] Message Index

[#] Next page

Go to full version