LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 09-26-2008, 10:15 PM   #1
datatab1
LQ Newbie
 
Registered: Sep 2005
Location: USA western
Distribution: fedora core 4
Posts: 10

Rep: Reputation: 0
Question c++ programs link but will not run


i don't know how to look for this so i have to ask. i hate asking, it makes me feel like an idiot, but i cannot find the answer anywhere.

i am running an amd64 machine with an msi mainboard, 512 mb ram (cant remember if i upgraded or not since, dunno how to check aside form pull the cover.)fc9(what a mistake) and i use gcc as my compiler, whatever came on the installer disk.

i am a wxWidgets programmer and have never had any issues like this, in fact i have never heard of this. linker errors or the program runs, simple as that. now what?

i built wxWidgets myself, i have a good share of experience doing that with the configure script so i really don't think it is a problem there, unless they wrote the script wrong somehow. then i opened an old project and got it ready to build. after all the linker and path garbage i got an executable to build. then i try to run it and it stops in 0 seconds. running in the terminal says that it cannot find library whatever. dynamically linking to wxWidgets i get the wx library not found, statically i get some system library not found. i messed with path and placement of wxwidgets as much as i could think of. i even put an alias in usr/local/lib and linked it to my wxWidgets folder. (wxW 2.8.8) i tried copying the libraries next to the app and the app next to the libraries, both in /usr/local/lib and in the build folder in my home directory. nothing works. not even using /usr/lib. i updated the ide as i changed everything, remember i got it to link, it just will not run.

what is going on?
 
Old 09-27-2008, 11:40 PM   #2
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
Hi -

You're right - in general, if you can link it, you *should* be able to run it. But there *are* exceptions. If it's saying "it cannot find library whatever" ... please cut/paste exactly *which* librar(ies)! That would definitely help.

Please try this:
1. Go back to your original build script (which presumably has reasonable defaults, and presumably uses shared libraries). Verify that you can compile and link without errors.

2. Run "ldd" on your executable.
This will tell you exactly what shared libraries you need, and exactly where the system expects to find them at runtime.
Cut/paste your ld output for future reference.

3. Run your program.
Carefully cut/paste any errors you see.

4. You might even consider compiling and linking your program with "-g", and running inside of "gdb". This might give additional info.

5. Post back all specifics:
a) exactly what you tried
b) exactly what happened (i.e. the ldd output, console errors and/or gdb errors you cut/pasted above)

Good luck .. PSM
 
Old 09-27-2008, 11:48 PM   #3
ta0kira
Senior Member
 
Registered: Sep 2004
Distribution: FreeBSD 9.1, Kubuntu 12.10
Posts: 3,078

Rep: Reputation: Disabled
You probably just need to run ldconfig. That's normally required before a newly-installed library will work. Many library installers will run it for you (mine do,) but not all. If that doesn't work, then go with what paulsm4 says.
ta0kira
 
Old 09-28-2008, 12:40 AM   #4
datatab1
LQ Newbie
 
Registered: Sep 2005
Location: USA western
Distribution: fedora core 4
Posts: 10

Original Poster
Rep: Reputation: 0
Talking

i found an article or something on adding to the library path. i didn't know how before and i didn't think it was an issue since everything built ok. it said redhat didn't put /usr/local/lib as part of the library search path. that is the wxwidgets default location. so that is what clued me in. (i run fedora) it said to edit ld.so.conf. so i did and ran ldconfig as root this time. now it works.

thanks
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
running executive programs from the command link golpemortal Fedora 7 03-11-2007 02:14 PM
specify which programs to pre-link true_atlantis Fedora 3 06-20-2006 02:33 PM
What do I need to run C++ programs ? tuxuser19 Programming 2 01-10-2006 08:48 PM
How do you link programs to files in KDE 3.2? jacatone Linux - Newbie 1 08-05-2005 03:25 PM
Link on desktop to run sh MasterC Linux - General 2 05-15-2002 06:56 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 01:06 AM.

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