LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-16-2004, 09:26 AM   #1
JurajPsycho
Member
 
Registered: Sep 2004
Distribution: Debian, kernel 2.6.10
Posts: 50

Rep: Reputation: 15
wxWindows


I'm trying to figure out, how to use wxWindows library. I want to create just simple application, that'll display selected image.
this is part of the code, that creates open file dialog and shoul display image into the frame....
Code:
void testFrame::OnOpen(wxCommandEvent& WXUNUSED( event) )
{
	wxFileDialog *fileDialog = new wxFileDialog(this, "Vyber subor", "", "", "*.*", wxOPEN, wxDefaultPosition);
	if( fileDialog->ShowModal() == wxID_OK)
	{
		//tak treba osetrit open
		wxBitmap *bitmap = new wxBitmap();
		bitmap->LoadFile(fileDialog->GetPath(), wxBITMAP_TYPE_XPM);
		if(bitmap == false)
		{
			wxMessageBox( wxT("Nepodarilo sa otvorit subor s obrazkom"), wxT("CHYBA"), wxOK|wxICON_ERROR, this);
			bitmap->~wxBitmap();
			return;
		}
		wxMessageBox( wxT("Obrazok by mal byt nacitany"), wxT("Subor OK"), wxOK|wxICON_INFORMATION, this);
		this->staticBitmap->SetBitmap(bitmap); 
	}
	fileDialog->Destroy();
}
but when I try to compile, I get an error message:
Code:
*/home/psycho/myprogs/test/src/test.cpp:97: error: no matching function for call to `wxStaticBitmap::SetBitmap(wxBitmap*& )' 
*/usr/include/wx/gtk/statbmp.h:44: error: candidates are: virtual void wxStaticBitmap::SetBitmap(const wxBitmap& )
what am I doing wrong?
J.
 
Old 10-16-2004, 09:31 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
going by that error, not defining your bitmap pointer as a const
Code:
		//tak treba osetrit open
		const wxBitmap *bitmap = new wxBitmap();
 
Old 10-16-2004, 09:45 AM   #3
JurajPsycho
Member
 
Registered: Sep 2004
Distribution: Debian, kernel 2.6.10
Posts: 50

Original Poster
Rep: Reputation: 15
no, I got one more error then
Code:
*/home/psycho/myprogs/test/src/test.cpp:88: error: passing `const wxBitmap' as `this' argument of `bool wxBitmap::LoadFile(const wxString&, int)' discards qualifiers 
*/home/psycho/myprogs/test/src/test.cpp:97: error: no matching function for call to `wxStaticBitmap::SetBitmap(const wxBitmap*&)' 
*/usr/include/wx/gtk/statbmp.h:44: error: candidates are: virtual void wxStaticBitmap::SetBitmap(const wxBitmap&)
J.
 
Old 10-16-2004, 09:58 AM   #4
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
right, ok so you are providing a pointer when it wants the direct object. I suck at pointers, but try either declaring as "const wxthiny bitmap" or dereference the pointer when you pass it- "SetBitmap(&bitmap)" don't blame me if that's wrong though! i'm a perl chap.
 
Old 10-16-2004, 10:04 AM   #5
itsme86
Senior Member
 
Registered: Jan 2004
Location: Oregon, USA
Distribution: Slackware
Posts: 1,246

Rep: Reputation: 59
What command are you using to compile? Are you telling the linker to link to the right library?
 
Old 10-17-2004, 01:49 AM   #6
The_Nerd
Member
 
Registered: Aug 2002
Distribution: Debian
Posts: 540

Rep: Reputation: 32
SDL

look at my sig for the link

(don't you guys just hate me? )
 
Old 10-17-2004, 05:01 AM   #7
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
Quote:
Originally posted by The_Nerd
SDL

look at my sig for the link

(don't you guys just hate me? )
what does this have to do with wxWindows? please keep it relelvant.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
installing wxWindows vickr1z Linux - Newbie 3 02-22-2014 11:27 PM
wxWindows - lmule phoenix_wolf Linux - Newbie 4 01-05-2005 12:27 PM
WxWindows and MingW Genjix Programming 0 01-01-2005 05:35 AM
wxWindows linking karlan Programming 0 07-28-2004 11:02 PM
wxWindows Skute Programming 2 10-31-2003 05:09 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:11 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration