LinuxQuestions.org
Visit the LQ Articles and Editorials section
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
 
LinkBack Search this Thread
Old 01-02-2006, 02:37 AM   #1
kornerr
Member
 
Registered: Dec 2004
Location: Russia, Siberia, Kemerovo
Distribution: Slackware
Posts: 893

Rep: Reputation: 35
Can't access methods of a struct


formatio.h
formatio.cpp
test_writer.h
test_writer.cpp
STR_LEN=512, format.h constains format of test file.

Code:
kornerr@darkstar:~/cpp/test2$ make
g++ -o obj/formatio.o -c formatio.cpp `wx-config --cxxflags`
g++ -o obj/test_writer.o -c test_writer.cpp `wx-config --cxxflags`
g++ -o test_writer obj/formatio.o obj/test_writer.o `wx-config --cxxflags`  `wx-config --libs`
obj/test_writer.o(.text+0xc1f): In function `Panel::OnOpenTxt(wxCommandEvent&)':
: undefined reference to `TestFile::OpenTxt(char*)'
collect2: ld returned 1 exit status
make: *** [test_writer] Error 1
I use wxWidgets lib for creating GUI, and can say for sure it's not because of wxWidgets. I just can't access ANY method of TestFile struct. What's wrong?

Thanks.
 
Old 01-02-2006, 11:11 AM   #2
Hko
Senior Member
 
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: ubuntu
Posts: 2,524

Rep: Reputation: 93
I think the errors are not due to a code error, but because you compiled (or more prcisely) linked incorrectly. Please post the gcc command line you use.
 
Old 01-02-2006, 11:19 AM   #3
kornerr
Member
 
Registered: Dec 2004
Location: Russia, Siberia, Kemerovo
Distribution: Slackware
Posts: 893

Original Poster
Rep: Reputation: 35
I've posted it (see lines after "make").
Also, I was told that it's impossible to use struct methods. When I changed struct to class, it have worked.
 
  


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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
alternate methods of parallel port access bobbens Programming 9 10-25-2005 08:47 AM
g++ and wrong struct member addresses / struct size misreporting sonajiso Linux - General 5 05-22-2004 10:16 PM
switch statement converting struct char to struct int oceaneyes2 Programming 2 12-10-2003 04:30 PM
Accessing a struct inside struct cxel91a Programming 1 09-17-2003 04:24 PM
Access Methods in Linux dominique Linux - Newbie 15 09-16-2001 12:09 PM


All times are GMT -5. The time now is 03:16 PM.

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
Open Source Consulting | Domain Registration