LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 12-29-2013, 09:21 PM   #1
Barry Brooks
LQ Newbie
 
Registered: Dec 2013
Location: Not hiding but ashamed that it is worse than New Jersey
Distribution: slackware 14.2
Posts: 2

Rep: Reputation: Disabled
No such file or directory, but the file is there.


The following code to make an inbox works now that I recompiled it in slackware14, but the binary compiled from the same source in puppy lupu
gives a "no such file..." message.

Also, I tried to get a package converted from a deb package to run and got the same message.

Why does slackware give a misleading error message?

I use this inbox program in scripts because it allows the enter key to
output the input text. I don't know of another input program that has a gui that doesn't require a mouse click to return the input.

Barry Brooks


/**
* compile with the following command
* gcc -Wall -g $f.c -o $f `pkg-config --libs --cflags gtk+-2.0`
* gcc -Wall -g hello.c -o hello `pkg-config --cflags gtk+-2.0` `pkg-config --libs gtk+-2.0`
*/

#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
#include <string.h>
// for EXIT_SUCCESS must #include <stdlib.h>

int xcode = 0;

gboolean delete1 (GtkWidget *widget, GdkEvent *event, gpointer udat)
{
xcode = 122;
return FALSE;
}

void destroy1 (GtkObject *object, gpointer udat)
{
xcode = 1;
gtk_main_quit();
}

gboolean key_pressed(GtkWidget * window, GdkEventKey* event, gpointer entry2) {

if ((event->keyval== GDK_Return)) {
gchar *strout=NULL;
// strout = g_strconcat(gtk_entry_get_text(GTK_ENTRY(entry2)), NULL);
strout = g_strdup(gtk_entry_get_text(GTK_ENTRY(entry2)));
int len; /* current line length */
len = strlen (strout);
if (len > 0) {
g_print ("%s\n", strout);
// g_print ("\n");
g_free(strout);
xcode = 0;
gtk_main_quit ();}
else {
xcode = 255;
gtk_main_quit ();}
}
return FALSE;
}

gboolean button_pressed(GtkWidget * window, gpointer entry3) {

gchar *strout=NULL;
strout = g_strdup(gtk_entry_get_text(GTK_ENTRY(entry3)));
int len; /* current line length */
len = strlen (strout);
if (len > 0) {
g_print ("%s\n", strout);
// g_print ("\n");
g_free(strout);
xcode = 0;
gtk_main_quit ();}
else {
xcode = 255;
gtk_main_quit ();}

return FALSE;
}

int main( int argc,
char *argv[] )
{
GtkWidget *window; // The main application window
GtkWidget *instruct; // GtkLabel "Enter Your Name:"
GtkWidget *entry; // GtkEntry box1
GtkWidget *box1; // Vertical box1 for packing widgets in the window
// GtkWidget *box2; // Vertical box1 for packing widgets in the window
GtkWidget *button; // What one pushes
char *labeltext = "Enter String";
char *windowtitle = "Input box1";
int iwidth;
int iheight;
gtk_init (&argc, &argv);


if (argc < 3)
{
iwidth = 300;
iheight = 75;
}
else
{
// iwidth = strtol (argv[1], &tail, 0);
// iheight = strtol (argv[2], &tail, 0);
iwidth = 600;
iheight = 150;
}

if (argc > 3)
{
labeltext = argv[3];
}

if (argc > 4)
{
windowtitle = argv[4];
}


// Create the top-level window
window = gtk_window_new (GTK_WINDOW_TOPLEVEL); // Create the window
gtk_container_set_border_width(GTK_CONTAINER(window),10); // Set a border around the edges
gtk_window_set_urgency_hint (GTK_WINDOW(window), TRUE); // Send the urgency signal to the window manager (e.g make the taskbar entry flash)
gtk_window_set_title (GTK_WINDOW(window),windowtitle); // Set the window title
gtk_window_set_default_size(GTK_WINDOW(window), iwidth, iheight);
gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);

g_signal_connect(G_OBJECT(window), "destroy", G_CALLBACK(destroy1), NULL);
g_signal_connect(G_OBJECT(window), "delete_event", G_CALLBACK(delete1), NULL);

box1 = gtk_vbox_new (FALSE, 0); // Create the vbox
gtk_container_add(GTK_CONTAINER(window), box1); // Add the vbox to the window
gtk_widget_show(box1); // Display the vbox (although you can't actually see anything)

instruct = gtk_label_new (labeltext);
gtk_box_pack_start (GTK_BOX (box1), instruct, TRUE, TRUE, 5); // Add the widget to the vbox (first item)
gtk_widget_show(instruct);

entry = gtk_entry_new();
gtk_box_pack_start (GTK_BOX (box1), entry, TRUE, TRUE, 5); // Add the widget to the vbox (second item)
gtk_widget_show(entry);
gtk_widget_grab_focus(entry);
g_signal_connect(G_OBJECT(entry), "key-press-event", G_CALLBACK(key_pressed), entry);

// box2 = gtk_hbox_new (FALSE, 0); // Create the vbox
// gtk_container_add(GTK_CONTAINER(window), box2); // Add the vbox to the window
// gtk_widget_show(box2); // Display the vbox (although you can't actually see anything)

button = gtk_button_new_with_label ("Done");
gtk_box_pack_start (GTK_BOX (box1), button, TRUE, TRUE, 5); // Add the widget to the hbox (second item)
gtk_widget_show (button);

g_signal_connect(button, "clicked", G_CALLBACK (button_pressed), entry);
gtk_widget_show (window); // Display the window
gtk_main (); // Start the Gtk Main Loop

return xcode;
}
 
Old 12-29-2013, 09:26 PM   #2
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886
Please use code-tags to post code, this will preserve formatting and make your posts much more readable.
To your problem, just a guess, but may it be possible that your Slackware installation is 64 bit without multilib, while that Puppy installation is 32 bit only?
 
Old 01-08-2014, 09:30 PM   #3
Barry Brooks
LQ Newbie
 
Registered: Dec 2013
Location: Not hiding but ashamed that it is worse than New Jersey
Distribution: slackware 14.2
Posts: 2

Original Poster
Rep: Reputation: Disabled
tobiSGD

Thanks for the advise. Multilib made the 32bit version run.

Barry
 
  


Reply



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



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Unziping & moving(mv) a .sh file to user directory is adding(?) ^M to file lines waddles Slackware 7 12-13-2013 05:37 PM
No such file or directory message when extracting the linux cpio file on window vista echang General 7 10-05-2012 02:19 PM
[SOLVED] cannot open shared object file: No such file or directory - but the file is there! Ook Slackware 5 08-24-2011 05:13 PM
Get first file of directory then copy to other directory andd rename the file Faye Linux - Software 4 01-30-2011 09:16 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 05:01 PM.

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