943,621 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Unsolved
  • Views: 1697
  • C++ RSS
You are currently viewing page 1 of this multi-page discussion thread
Dec 4th, 2007
0

Problem compiling

Expand Post »
Hello, I'm following this tutorial http://fox-toolkit.net/cgi-bin/wiki...._Simple_Window
To learn how to make gui programs using the fox toolkit, but I can't get it to compile.
This is what I have in main.cpp
C++ Syntax (Toggle Plain Text)
  1. #include <fx.h>
  2.  
  3. #include "mywindow.h"
  4.  
  5. FXDEFMAP(MyWindow) MyWindowMap[]={0
  6.  
  7. };
  8.  
  9. FXIMPLEMENT(MyWindow,FXMainWindow,MyWindowMap,ARRAYNUMBER(MyWindowMap));
  10.  
  11. int main(int argc,char ** argv) {
  12.  
  13.  
  14.  
  15. FXApp application("Tutorial #1","FOX Tutorials");
  16.  
  17.  
  18.  
  19. application.init(argc,argv);
  20.  
  21.  
  22.  
  23. new MyWindow(&application);
  24.  
  25.  
  26.  
  27. application.create();
  28.  
  29.  
  30.  
  31. return application.run();
  32.  
  33. }
This is what I have in mywindow.h
C++ Syntax (Toggle Plain Text)
  1. class MyWindow : public FXMainWindow {
  2.  
  3. FXDECLARE(MyWindow)
  4.  
  5. private:
  6.  
  7. MyWindow() {}
  8.  
  9. public:
  10.  
  11. MyWindow(FXApp *);
  12.  
  13. virtual ~MyWindow();
  14.  
  15. virtual void create();
  16.  
  17. };
  18.  
  19. void MyWindow::create(){
  20.  
  21. FXMainWindow::create();
  22.  
  23. show(PLACEMENT_SCREEN);
  24.  
  25. }
But I'm getting these errors
C++ Syntax (Toggle Plain Text)
  1. objs\main.o:main.cpp:(.text+0x376): undefined reference to `MyWindow::MyWindow(FX::FXApp*)'
  2.  
  3. objs\main.o:main.cpp:(.rdata$_ZTV8MyWindow[vtable for MyWindow]+0x20): undefined reference to `MyWindow::~MyWindow()'
  4.  
  5. objs\main.o:main.cpp:(.rdata$_ZTV8MyWindow[vtable for MyWindow]+0x24): undefined reference to `MyWindow::~MyWindow()'
  6.  
  7. collect2: ld returned 1 exit status
  8.  
I've searched ,but I can't figure out the answer.

I'm using windows with codeblocks and mingw.
Last edited by curt22; Dec 4th, 2007 at 5:14 pm.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Junior Poster in Training
curt22 is offline Offline
56 posts
since Sep 2007
Dec 4th, 2007
0

Re: Problem compiling

the link you posted doesn't go to a tutorial. Did you download the precompiled package or the source code and compile it yourself ?
Sponsor
Team Colleague
Featured Poster
Reputation Points: 5608
Solved Threads: 2282
Retired and Enjoying Life
Ancient Dragon is offline Offline
21,947 posts
since Aug 2005
Dec 4th, 2007
0

Re: Problem compiling

sorry. Here is the link:
http://fox-toolkit.net/cgi-bin/wiki...._Simple_Window
Also I copyed and pasted the example code like it said to.
Reputation Points: 10
Solved Threads: 0
Junior Poster in Training
curt22 is offline Offline
56 posts
since Sep 2007
Dec 4th, 2007
0

Re: Problem compiling

My guess is that you are not linking with the fox libraries. I tried to download it but only got errors that page cannot be displayed.
Sponsor
Team Colleague
Featured Poster
Reputation Points: 5608
Solved Threads: 2282
Retired and Enjoying Life
Ancient Dragon is offline Offline
21,947 posts
since Aug 2005
Dec 4th, 2007
0

Re: Problem compiling

I am linking with C:\fox\fox-1.6.31\lib\libFOXD-1.6.a.
Also the download is working for me you can get it here:
http://www.fox-toolkit.org/download.html
(I am using version 1.6.31)
Reputation Points: 10
Solved Threads: 0
Junior Poster in Training
curt22 is offline Offline
56 posts
since Sep 2007
Dec 5th, 2007
0

Re: Problem compiling

Could someone please help.
Reputation Points: 10
Solved Threads: 0
Junior Poster in Training
curt22 is offline Offline
56 posts
since Sep 2007
Dec 5th, 2007
0

Re: Problem compiling

So do you have a mywindow.cpp which implements the rest of the functionality of your class in mywindow.h ?
Team Colleague
Reputation Points: 5862
Solved Threads: 950
Posting Sage
Salem is offline Offline
7,164 posts
since Dec 2005
Dec 5th, 2007
0

Re: Problem compiling

Click to Expand / Collapse  Quote originally posted by Salem ...
So do you have a mywindow.cpp which implements the rest of the functionality of your class in mywindow.h ?
I only have two files main.cpp & mywindow.h like the tutorial said. They are attached to this post.
Attached Files
File Type: cpp main.cpp (387 Bytes, 22 views)
File Type: h mywindow.h (286 Bytes, 22 views)
Reputation Points: 10
Solved Threads: 0
Junior Poster in Training
curt22 is offline Offline
56 posts
since Sep 2007
Dec 6th, 2007
0

Re: Problem compiling

Well they need to be implemented SOMEWHERE.

My guess is since you've prefixed it with 'my', then it's your responsibility to implement it.
Team Colleague
Reputation Points: 5862
Solved Threads: 950
Posting Sage
Salem is offline Offline
7,164 posts
since Dec 2005
Dec 6th, 2007
0

Re: Problem compiling

curt22: if you re-read that tutorial you will see where it talks about mywindow.cpp, located about 3/4th down in the tutorial.
Quote ...
The only thing left to do, is to implement our "MyWindow" class ...
Sponsor
Team Colleague
Featured Poster
Reputation Points: 5608
Solved Threads: 2282
Retired and Enjoying Life
Ancient Dragon is offline Offline
21,947 posts
since Aug 2005

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: How to represent a space and a tab?
Next Thread in C++ Forum Timeline: Need help on pointers/classes/arrays





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC