Guidance
指路人
g.yi.org
Guidance Forums / wxWidgets (wxWindows) in C++ / strange problem using pointer in devcpp with wxwindows

Register 
注册
Search 搜索
首页 
Home Home
Software
Upload

  
Forum List • Thread List • Refresh • New Topic • Search • Previous • Next First 1 Last
Message1. strange problem using pointer in devcpp with wxwindows
#2983
Posted by: 2003-11-26 02:39:47
Hello,

  I hope, I'm not offtopic.
  I have a strange problem with devcpp 4.9.8.0. and wxwindows.
  The code is located after the creation of a new thread.

  CProgressDlg* u = new CProgressDlg;
  u->Create(NULL, 1, wxT("Operation in progress ..."), wxDefaultPosition, wxDefaultSize, wxCAPTION);
  u->ShowModal();
  wxMessageBox("hhadsafds");
 
  Create or OnInitDialog will never be called, but if I replace it at the same location with:
  
  CProgressDlg u;
  u.Create(NULL, 1, wxT("Operation in progress ..."), wxDefaultPosition, wxDefaultSize, wxCAPTION);
  u.ShowModal();
  wxMessageBox("hhadsafds");
 
  everything is ok. (at the time wxmessagebox is called, the progressdialog is already shown)

  Is it a problem with the g++ compiler?
 
  How can it be? I feel lost :(
  In visual c++, the same code apparantly works.
 
  If I call (the version with the pointer) in another file, everything is fine.
 
 
  g++.exe -c OpCopy.cpp -o OpCopy.o -I...."C:/Programme/Dev-Cpp/include/c++"  -I"c:/Programme/De
  v-Cpp/include/c++/mingw32"  -I"c:/Programme/wxWindows-2.4.2/include"  -I"c:/Programme/wxWi
  ndows-2.4.2/contrib/include"  -I"c:/Eigene Dateien/src/atol/atol031/my/src/src/" -DWINVER=
  0x0400 -D__WIN95__  -D__GNUWIN32__  -DSTRICT   -DHAVE_W32API_H -D__WXMSW__  -D__WINDOWS__
   -fno-rtti  -fno-exceptions  -DWXUSINGDLL=1
 
  (I have compiled wxwindows myself with usingdll and final=1)
 
2nd question:

  What can I use instead of the following code in dev-cpp?
    (there is no comdef.h)
 
  #include <comdef.h>

  class PIDL
  {
  public:
    static inline IShellFolderPtr    GetDesktopFolder(){ return m_sfDesktop; };
    static inline IMallocPtr       GetMalloc(){ return m_piMalloc; };

  Many thanks, if someone can give me a hint, how to resolve this issues.

Message2. Re: strange problem using pointer in devcpp with wxwindows
#2995
Posted by: 2003-11-27 04:10:20
addition:

g++.exe -D__DEBUG__ AtolApp.o BookmarkEditDlg.o BrowseBookmarkList.o BrowseHistoryList.o CommandLineCtrl.o
                    DatePickerDlg.o DeleteDlg.o DirTraverser.o FileListCtrl.o FilePanel.o ...........
                    xy.res -o "xy.exe" -L"C:/Programme/Dev-Cpp/lib" -L"c:/Programme/wxWindows-2.4.2/lib"
                    -mwindows -lstc  -lwxmsw242 -lpng  -ljpeg  -lzlib  -ltiff  -lcomdlg32  -luser32 
                    -lgdi32  -lole32  -lwsock32  -lcomctl32  -lctl3d32  -lgcc  -lstdc++  -lshell32 
                    -loleaut32  -ladvapi32  -luuid  -lshlwapi

c:ProgrammeDev-Cppbin..libgcc-libmingw323.2........mingw32binld.exe: OpCopy
.o: warning: duplicate section `.data$_ZTV14wxCommandEvent' has different size
c:ProgrammeDev-Cppbin..libgcc-libmingw323.2........mingw32binld.exe: OpCopy
.o: warning: duplicate section `.data$_ZTV7wxEvent' has different size
c:ProgrammeDev-Cppbin..libgcc-libmingw323.2........mingw32binld.exe: OpDele
te.o: warning: duplicate section `.data$_ZTV14wxCommandEvent' has different size
c:ProgrammeDev-Cppbin..libgcc-libmingw323.2........mingw32binld.exe: OpDele
te.o: warning: duplicate section `.data$_ZTV7wxEvent' has different size

these warnings are suspicious (?)
What do they mean?

thank you in advance

Message3. Re: strange problem using pointer in devcpp with wxwindows
#3001
Posted by: upCASE 2003-11-27 20:04:32
Hi!
I remeber there were some issues about not creating objects on the heap while working with wxWindows. Maybe I'm wrong. There surely is a possibility that g++ causes the error. Have you checked the mingw or gcc mailing lists?

For your second post: I'd guess that this error could be solved by recompiling your whole project. Normally these warnings come from previously compiled object files. Have you changed the wxWindows version or updated the compiler?

Sorry fro being no real help here.

upcase
upCASE
-----------------------------------
If it was hard to write, it should be hard to read!- Do. Or do not. There is no try!
Message4. Re: strange problem using pointer in devcpp with wxwindows
#3008
Posted by: 2003-11-28 02:58:09
hello upcase,

thanks for your reply; it's my first attempt to compile a project, which
runs apparently in visual c++.
i will try to recompile wxwindows and look, what this linker warnings
mean.

Francesco
Message5. Re: strange problem using pointer in devcpp with wxwindows
#3022
Posted by: 2003-11-29 04:10:18
Hello,

I found, that this problem takes place only, it the Progress Dialag will be called inside the class, which is derived from wxThread; outside everything is all right.

Can it has to do with compiler or linker settings?
or have I to attend other things with wxthread or is the problem
outside all this?

thank you
Message6. Re: strange problem using pointer in devcpp with wxwindows
#3026
Posted by: 2003-11-29 22:06:54
with -mthreads didn't help either, nor trying to initialize
detatched and joinable threads.
Message7. Re: strange problem using pointer in devcpp with wxwindows
#3035
Posted by: 2003-12-01 00:46:36
Hello,

the problem is solved :)

I had to create the Progress dialog in the main thread (then, the OnInitdlg
will be called); otherwise not.

regards

Francesco
Forum List • Thread List • Refresh • New Topic • Search • Previous • Next First 1 Last
掌柜推荐
 
 
 
 
 
 
 
 
 
 
 
 
© Tue 2024-12-10  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0