ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
For some reason one of my computers has stopped executing C programs. On startup it will be fine for a bit and then (presumably after some unknown event) will not run any of my c programs.
I can compile and run a new C program that will work and it will run Tcl and bash scripts but not C.
Sorry there isn't more information but it hasn't happened many times.
For some reason one of my computers has stopped executing C programs. On startup it will be fine for a bit and then (presumably after some unknown event) will not run any of my c programs.
I can compile and run a new C program that will work and it will run Tcl and bash scripts but not C.
Sorry there isn't more information but it hasn't happened many times.
Thanks,
ectof
I think items in red and blue contradict each other.
The distro is a quite old version of suse (7.?) and gcc is 3.3, it has been reasonably stable up to now.
I meant that I could compile and run the executable of a new program, but I cannot run programs that have been compiled previously i.e. before the last boot up.
The distro is a quite old version of suse (7.?) and gcc is 3.3, it has been reasonably stable up to now.
I meant that I could compile and run the executable of a new program, but I cannot run programs that have been compiled previously i.e. before the last boot up.
ectof
So, post (copy-paste) the source, command lines you used to compile and link, command lines you used to invoke the newly produced programs and the error messages they produce.
Thanks for your help so far.
So I managed to find out a bit more.
The program I was testing with was just the most basic 'hello_world.c'
When I compile and run
#include <stdio.h>
int main() {
printf("hello world\n");
return 0;
}
gcc 'hello_world.c'
./a.out
it gives the expected 'hello world'
But, if I do
gcc 'hello_world.c' -lgpibapi
./a.out
It seems to compile OK and then when I execute it just hangs.
I then tried
gcc 'hello_world.c' -lm
./a.out
and again it executes.
As I say the on immediate startup things are OK but then it stops working.
If you have any idea why this might happen for this library that would be great. I guess I am doing something to screw up the gpib, but I have no idea what.
Can you post ldd a.out (when the program doesn't execute)? Do you happen to have two versions of libgpibapi with the same soname? Also post ls -l /usr/lib/libgpibapi/libgpibapi* (adjust path as applicable.)
Kevin Barry
Have you recompiled all (or at least one) of the non-functioning programs? Maybe you updated the library and they are linked against the wrong version.
It seems like it has something to do with the loading of that particular library (i.e. the _init function.) Why do you try to link to it? Does it replace something contained in libm?
Kevin Barry
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.