LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
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-12-2005, 09:27 AM   #1
kornerr
Member
 
Registered: Dec 2004
Location: Russia, Siberia, Kemerovo
Distribution: Slackware
Posts: 893

Rep: Reputation: 35
wxWidgets


I get "Segmentation fault" when try to do
Code:
map->skybox.back.filename = "string";
map is a pointer to Map class.
filename is of wxString class.
I can't understand what's wrong here, because when I do
Code:
map->skybox.back.texid = 1
it doesn't cause the error.
texid is of GLint type.

I even tried to change filename to string type, not wxString class, but with no success. Even memset was done for skybox...

I'm at a loss what to do, and what can cause the error

Can anyone help me?

Thanks.

PS: Sources
(remove ".doc" from the filename)
The sources require wxWidgets and OpenGL.
Call "Map->Skybox->OK" and you will get "Segmentation fault".
 
Old 10-13-2005, 09:46 AM   #2
destuxor
Member
 
Registered: Oct 2005
Posts: 51

Rep: Reputation: 16
I don't have time to take a look at the code but here's a really wild guess. You need to save a string into a char array, right? Since map->skybox.back.filename is a pointer to the first character to that array, what you need to do is add a "*" to that statement:
Code:
* map->skybox.back.filename = "string";
That's a really wild guess. If it doesn't work tell me and I'll actually RTFsource.
 
Old 10-13-2005, 10:05 AM   #3
kornerr
Member
 
Registered: Dec 2004
Location: Russia, Siberia, Kemerovo
Distribution: Slackware
Posts: 893

Original Poster
Rep: Reputation: 35
Thanks, destuxor.

Well, I was answered at wxWidgets forum about that already
the problem is in memset (&skybox, 0, sizeof (skybox))
because when it's done, wxString field is destroyed (as well as string field) and this causes the error.
If it has char* (built-in type) all works ok.

Thanks.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
xml + wxwidgets wmoti Programming 1 10-27-2005 10:34 PM
Problems with wxWidgets DonBilbo Linux - Software 3 10-12-2005 09:21 AM
wxwidgets or gtk?? logicalfuzz Linux - Software 3 09-21-2005 12:43 PM
Using OpenGL thru wxWidgets, need help kornerr Programming 5 09-15-2005 10:09 AM
wxwidgets, anyone used it? acidjuice Programming 6 03-31-2005 03:28 AM


All times are GMT -5. The time now is 09:33 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration