Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4059632
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T15:14:03+00:00 2026-05-20T15:14:03+00:00

The error is very unusual for me.. No file name.. Not a correct line

  • 0

The error is very unusual for me..
No file name..
Not a correct line number
Error is :
building menus failed: Error on line 1 char 19: Odd character ‘’’, expected an open quote mark after the equals sign when giving value for attribute ‘action’ of

File: examplewindow.h

#ifndef GTKMM_EXAMPLEWINDOW_H
#define GTKMM_EXAMPLEWINDOW_H
#include <gtkmm.h>
class ExampleWindow : public Gtk::Window
{
public:
ExampleWindow();
virtual ~ExampleWindow();
protected:
//Signal handlers:
virtual void on_menu_file_new_generic();
virtual void on_menu_file_quit();
virtual void on_menu_others();
virtual void on_menu_choices_one();
virtual void on_menu_choices_two();
//Child widgets:
Gtk::VBox m_Box;
Glib::RefPtr<Gtk::UIManager> m_refUIManager;
Glib::RefPtr<Gtk::ActionGroup> m_refActionGroup;
Glib::RefPtr<Gtk::RadioAction> m_refChoiceOne, m_refChoiceTwo;
};
#endif //GTKMM_EXAMPLEWINDOW_H

File: main.cc

#include <gtkmm/main.h>
#include "examplewindow.h"
int main(int argc, char *argv[])
{
Gtk::Main kit(argc, argv);
ExampleWindow window;
//Shows the window and returns when it is closed.
Gtk::Main::run(window);
return 0;
}

File: examplewindow.cc

#include "examplewindow.h"
#include <gtkmm/stock.h>
#include <iostream>
ExampleWindow::ExampleWindow()
{
set_title("main menu example");
set_default_size(200, 200);
add(m_Box); // put a MenuBar at the top of the box and other stuff below it.
//Create actions for menus and toolbars:
m_refActionGroup = Gtk::ActionGroup::create();
//File|New sub menu:
m_refActionGroup->add(Gtk::Action::create("FileNewStandard",
G    tk::Stock::NEW, "_New", "Create a new file"),
sigc::mem_fun(*this, &ExampleWindow::on_menu_file_new_generic));
m_refActionGroup->add(Gtk::Action::create("FileNewFoo",
Gtk::Stock::NEW, "New Foo", "Create a new foo"),
sigc::mem_fun(*this, &ExampleWindow::on_menu_file_new_generic));
m_refActionGroup->add(Gtk::Action::create("FileNewGoo",
Gtk::Stock::NEW, "_New Goo", "Create a new goo"),
sigc::mem_fun(*this, &ExampleWindow::on_menu_file_new_generic));
//File menu:
m_refActionGroup->add(Gtk::Action::create("FileMenu", "File"));
//Sub-menu.
m_refActionGroup->add(Gtk::Action::create("FileNew", Gtk::Stock::NEW));
m_refActionGroup->add(Gtk::Action::create("FileQuit", Gtk::Stock::QUIT),
sigc::mem_fun(*this, &ExampleWindow::on_menu_file_quit));
//Edit menu:
m_refActionGroup->add(Gtk::Action::create("EditMenu", "Edit"));
m_refActionGroup->add(Gtk::Action::create("EditCopy", Gtk::Stock::COPY),
sigc::mem_fun(*this, &ExampleWindow::on_menu_others));
m_refActionGroup->add(Gtk::Action::create("EditPaste", Gtk::Stock::PASTE),
sigc::mem_fun(*this, &ExampleWindow::on_menu_others));
m_refActionGroup->add(Gtk::Action::create("EditSomething", "Something"),
Gtk::AccelKey("<control><alt>S"),
sigc::mem_fun(*this, &ExampleWindow::on_menu_others));
//Choices menu, to demonstrate Radio items
m_refActionGroup->add( Gtk::Action::create("ChoicesMenu", "Choices") );
Gtk::RadioAction::Group group_userlevel;
m_refChoiceOne = Gtk::RadioAction::create(group_userlevel, "ChoiceOne", "One");
m_refActionGroup->add(m_refChoiceOne,
sigc::mem_fun(*this, &ExampleWindow::on_menu_choices_one) );
m_refChoiceTwo = Gtk::RadioAction::create(group_userlevel, "ChoiceTwo", "Two");
m_refActionGroup->add(m_refChoiceTwo,
sigc::mem_fun(*this, &ExampleWindow::on_menu_choices_two) );
//Help menu:
m_refActionGroup->add( Gtk::Action::create("HelpMenu", "Help") );
m_refActionGroup->add( Gtk::Action::create("HelpAbout", Gtk::Stock::HELP),
sigc::mem_fun(*this, &ExampleWindow::on_menu_others) );
m_refUIManager = Gtk::UIManager::create();
m_refUIManager->insert_action_group(m_refActionGroup);
add_accel_group(m_refUIManager->get_accel_group());
//Layout the actions in a menubar and toolbar:
Glib::ustring ui_info =
"<ui>"
" <menubar name=’MenuBar’>"
"
<menu action=’FileMenu’>"
"
<menu action=’FileNew’>"
"
<menuitem action=’FileNewStandard’/>"
"
<menuitem action=’FileNewFoo’/>"
"
<menuitem action=’FileNewGoo’/>"
"
</menu>"
"
<separator/>"
"
<menuitem action=’FileQuit’/>"
"
</menu>"
"
<menu action=’EditMenu’>"
"
<menuitem action=’EditCopy’/>"
"
<menuitem action=’EditPaste’/>"
"
<menuitem action=’EditSomething’/>"
"
</menu>"
"
<menu action=’ChoicesMenu’>"
"
<menuitem action=’ChoiceOne’/>"
"
<menuitem action=’ChoiceTwo’/>"
"
</menu>"
"
<menu action=’HelpMenu’>"
"
<menuitem action=’HelpAbout’/>"
"
</menu>"
" </menubar>"
" <toolbar name=’ToolBar’>"
"
<toolitem action=’FileNewStandard’/>"
"
<toolitem action=’FileQuit’/>"
" </toolbar>"
"</ui>";
#ifdef GLIBMM_EXCEPTIONS_ENABLED
try
{
m_refUIManager->add_ui_from_string(ui_info);
}
catch(const Glib::Error& ex)
{
std::cerr << "building menus failed: " << ex.what();
}
#else
std::auto_ptr<Glib::Error> ex;
m_refUIManager->add_ui_from_string(ui_info, ex);
if(ex.get())
{
std::cerr << "building menus failed: " << ex->what();
}
#endif //GLIBMM_EXCEPTIONS_ENABLED
//Get the menubar and toolbar widgets, and add them to a container widget:
Gtk::Widget* pMenubar = m_refUIManager->get_widget("/MenuBar");
if(pMenubar)
m_Box.pack_start(*pMenubar, Gtk::PACK_SHRINK);
Gtk::Widget* pToolbar = m_refUIManager->get_widget("/ToolBar") ;
if(pToolbar)
m_Box.pack_start(*pToolbar, Gtk::PACK_SHRINK);
show_all_children();
}
ExampleWindow::~ExampleWindow()
{
}
void ExampleWindow::on_menu_file_quit()
{
hide(); //Closes the main window to stop the Gtk::Main::run().
}
void ExampleWindow::on_menu_file_new_generic()
{
std::cout << "A File|New menu item was selected." << std::endl;
}
void ExampleWindow::on_menu_others()
{
std::cout << "A menu item was selected." << std::endl;
}
void ExampleWindow::on_menu_choices_one()
{
Glib::ustring message;
if(m_refChoiceOne->get_active())
message = "Choice 1 was selected.";
else
message = "Choice 1 was deselected";
std::cout << message << std::endl;
}
void ExampleWindow::on_menu_choices_two()
{
Glib::ustring message;
if(m_refChoiceTwo->get_active())
message = "Choice 2 was selected.";
else
message = "Choice 2 was deselected";
std::cout << message << std::endl;
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T15:14:04+00:00Added an answer on May 20, 2026 at 3:14 pm

    Looks like you’re using the wrong quote in your xml string. Try ' not ’

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Ok, I asked about this very error earlier this week and had some very
I am getting this error but only very occasionally. 99.9% of the time it
I got a very similar error to the one below: How can I fix
I'm having a very confusing error between SharePoint and SQL Server 2k5. My SQL
I have come across a very weird error. I'm on Solaris 10, using Ruby
I am getting a very strange error in my code. This assignment is for
I'm seeing a very strange error when trying to use ViewPagerIndicator (http://viewpagerindicator.com/). I've narrowed
I am getting process.nextTick error on this very basic example of node.js. Can someone
I found the always stop on error (dbstop if error) to be very useful
Today I've got a stacktrace with a very strange error. Actually, I may be

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.