I've asked this at Stack Overflow but my question was marked as a duplicate and when I go to the link where they say my question is already answered there, I can't solve the problem because I don't really know what causes it. So, Here am I.
I code on Linux and compile with g++. I use gtkmm-3.16 to be precise. But I got the code from a gtkmm documentation for version 3.12. But I know that this error has nothing to do with gtkmm right?
This is the error message
1 2 3 4 5 6
ander@Ander:~/C++_Programming/test$ g++ main.cc -o main `pkg-config gtkmm-3.0 --cflags --libs`
/tmp/ccZE6Q0g.o: In function `main':
main.cc:(.text+0x7b): undefined reference to `ExampleWindow::ExampleWindow()'
main.cc:(.text+0xb6): undefined reference to `ExampleWindow::~ExampleWindow()'
main.cc:(.text+0x127): undefined reference to `ExampleWindow::~ExampleWindow()'
collect2: error: ld returned 1 exit status
Below are the files. I compile main.cc not examplewindow.cc so I know I'm on the right track except that I stopped progressing further learning C++ and GTKMM when I got the compilation error message above which I can't make any sense out of.
#include "examplewindow.h"
#include <gtkmm/application.h>
int main(int argc, char *argv[])
{
Glib::RefPtr<Gtk::Application> app = Gtk::Application::create(argc, argv, "org.gtkmm.example");
ExampleWindow window;
//Shows the window and returns when it is closed.
return app->run(window);
}
Now I'm waiting for answers. And doing other stuff than coding 'cause it's stressful to wait in front of the computer. Please answer ASAP.
I'm sure you guys are beginner-friendly people rather than those guys at stackoverflow.
ander@Ander:~/C++_Programming/test$ g++ main.cc -o seimple `pkg-config gtkmm-3.0 --cflags --libs`
main.cc: In function ‘int main(int, char**)’:
main.cc:6:10: error: ‘app’ does not name a type
auto app = Gtk::Application::create(argc, argv, "org.gtkmm.example");
^
main.cc:9:12: error: ‘app’ was not declared in this scope
return app->run(window);
^
main.cc: In member function ‘void ExampleWindow::on_button_dialog_clicked()’:
main.cc:75:7: error: ‘cout’ is not a member of ‘std’
std::cout << "Cancel clicked." << std::endl;
^
main.cc:80:7: error: ‘cout’ is not a member of ‘std’
std::cout << "Unexpected button clicked: " << result << std::endl;
^