Hello, I'm following this tutorial http://fox-toolkit.net/cgi-bin/wiki.pl?Tutorial__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

#include <fx.h>

 #include "mywindow.h"

FXDEFMAP(MyWindow) MyWindowMap[]={0

 };

 FXIMPLEMENT(MyWindow,FXMainWindow,MyWindowMap,ARRAYNUMBER(MyWindowMap));

 int main(int argc,char ** argv) {



  FXApp application("Tutorial #1","FOX Tutorials");



  application.init(argc,argv);



  new MyWindow(&application);



  application.create();



  return application.run();

 }

This is what I have in mywindow.h

class MyWindow : public FXMainWindow {

    FXDECLARE(MyWindow)

     private:

  MyWindow() {}

   public:

  MyWindow(FXApp *);

  virtual ~MyWindow();

     virtual void create();

 };

 void MyWindow::create(){

  FXMainWindow::create();

  show(PLACEMENT_SCREEN);

 }

But I'm getting these errors

objs\main.o:main.cpp:(.text+0x376): undefined reference to `MyWindow::MyWindow(FX::FXApp*)'

objs\main.o:main.cpp:(.rdata$_ZTV8MyWindow[vtable for MyWindow]+0x20): undefined reference to `MyWindow::~MyWindow()'

objs\main.o:main.cpp:(.rdata$_ZTV8MyWindow[vtable for MyWindow]+0x24): undefined reference to `MyWindow::~MyWindow()'

collect2: ld returned 1 exit status

I've searched ,but I can't figure out the answer.

I'm using windows with codeblocks and mingw.

Recommended Answers

All 10 Replies

the link you posted doesn't go to a tutorial. Did you download the precompiled package or the source code and compile it yourself ?

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.

Could someone please help. :confused:

So do you have a mywindow.cpp which implements the rest of the functionality of your class in mywindow.h ?

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.

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.

curt22: if you re-read that tutorial you will see where it talks about mywindow.cpp, located about 3/4th down in the tutorial.

The only thing left to do, is to implement our "MyWindow" class ...

curt22: if you re-read that tutorial you will see where it talks about mywindow.cpp, located about 3/4th down in the tutorial.

Thanks I guess I read it wrong. :$ I'm going to reread it later (I can't now). Then I'll let you know what happens.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.