Results 1 to 9 of 9
  1. #1
    Join Date
    Apr 2002
    Location
    Los Angeles
    Posts
    242

    Compiling error with wxWidgets OpenGl VTM

    i was running through the opengl VTM specifically the wxWidgets. I searched the forum but couldn't find anything on it. the problem is that when I try to complie it gives me the following error.

    Code:
    error C2664: 'wxWindow::SetTitle' : cannot convert parameter 1 from 'char [80]' to 'const wxString &'
    It hapens for this line of code

    Code:
    GetParent()->SetTitle(title);
    I went through the video but I don't see what my problem is. Any help
    would be great.

    Thanks

  2. #2
    Join Date
    Oct 2005
    Location
    Seattle, WA
    Posts
    501
    Looks like you are trying to pass in an array of chars when SetTitle() is actually looking for a wxString. Try declaring 'title' as a wxString instead of a char array. Or if you don't want to do that try:
    Code:
    GetParent()->SetTitle(wxString(title));

  3. #3
    Join Date
    Apr 2002
    Location
    Los Angeles
    Posts
    242
    thanks for the help but I tried that before i posted here, along with other things. Including reviewing the videos a couple times.

    Thanks for the help

  4. #4
    Join Date
    Aug 2004
    Location
    little rock arkansas
    Posts
    3,482

    Talking

    did you change the variable title to a wxString?

    also have you used the Unicode macro i think it was T(title)
    ME WANT AGENTS ME WANT AGENTS ME WANT AGENTS

  5. #5
    Join Date
    Apr 2002
    Location
    Los Angeles
    Posts
    242
    Thanks for the help ostamo2. I have what they put in the OpenGL VTM. This is what I have.

    Code:
    GLFrame::GLFrame(wxWindow *parent, const wxString &title, const wxPoint &pos,
    const wxSize &size, long style) : wxFrame(parent, wxID_ANY, title, pos, size, style)
    I did try theunicode macro it also did not work. Thanks again.

  6. #6
    Join Date
    Jul 2004
    Posts
    249
    I could never get wxWidgets to run in Visual Studio, so tonight I tried doing the wxWidgets OpenGL VTM in wxDevC++. I got it working when I comment out the same line as Soul had problems with.

    I get this error message:
    89 'class wxWindow' has no member named 'SetTitle'

    Yet when I type in up to GetParent()-> the code completion brings up a list and SetTitle is in that list? Very strange.

    I can't figure out what the problem is.

  7. #7
    Join Date
    Aug 2004
    Location
    little rock arkansas
    Posts
    3,482

    Talking

    you need to have a const wxString &title

    so you need to pass the address of the title i think
    ME WANT AGENTS ME WANT AGENTS ME WANT AGENTS

  8. #8
    Join Date
    Aug 2009
    Location
    Indianapolis, IN
    Posts
    13
    GetParent()->SetLabel(title); // using wxWidgets 2.8.10

    Quote Originally Posted by soul View Post
    i was running through the opengl VTM specifically the wxWidgets. I searched the forum but couldn't find anything on it. the problem is that when I try to complie it gives me the following error.

    Code:
    error C2664: 'wxWindow::SetTitle' : cannot convert parameter 1 from 'char [80]' to 'const wxString &'
    It hapens for this line of code

    Code:
    GetParent()->SetTitle(title);
    I went through the video but I don't see what my problem is. Any help
    would be great.

    Thanks

  9. #9
    Join Date
    Apr 2002
    Location
    Los Angeles
    Posts
    242
    Quote Originally Posted by jryan View Post
    GetParent()->SetLabel(title); // using wxWidgets 2.8.10
    Thanks for the help jryan. I actually posted this about 2.5 years ago. But thanks anyway.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •