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.
I recently upgraded from Slackware 11 to 12 and with it GCC from 3.4.6 to 4.1.2. I am now trying to compile and run a program I have written which runs perfectly well under slackware 11 but which compiles fine, but will not run under 12. I get a halt in the execution of the code when I try to use ofstream. I have checked that the file exists and no handles are open to it and that the permissions for the file are correct. The code compiles so I know that I have not missed a #include (and it works on GCC 3.4.6). This is driving me nuts!
I alos have another problem (with the same code). I have an executable and a set of shared libraries. If I try to load a library from the executable all is well. If I try to load a library from another library the code crashes. Again this did used to work on GCC 3.4.6.
Thanks for your reply. I have checked the changelog and I could see no mention of altering anything to do with ofstream (or associated functions). I have also searched on the internet for this problem and there have been a few occurences of people having difficulties with associated ofstream functions with GCC 4.1.2, but no-one seems to have found an answer and they all are stopping the code from compiling, where as mine compiles fine, just won't run!
Thnaks for your reply. Unfortunately this seems to be an intermittent problem so I get different results from different runs through of the same code! I am currently looking at the file system I am using to see if this is the problem.
I also have another issue with the dlopen function. This does fail repeatedly if I call it from a shared library. If I call it from an exe then it succeeds without a problem. I've checked all of the obvious things like making sure the library exists, permissions and file path and they are all correct. I am using the same code to load the libraries from either the shared library or the exe. This used to work no problem before I upgraded my OS!
/////////////////////////////////////////////////////////////////////////////////////
//Method : Load
//Description : This function loads a module from the host.
//Input Params : ModuleName - The name of the module to load.
//Output Params : None
//Return : true if the module was loaded false otherwise.
/////////////////////////////////////////////////////////////////////////////////////
bool Load(const string& ModuleName)
{
bool success = true;
The code fails on the dlopen line. It never gets past it, there is no error code generated but if I put a printf statement on the following line it never gets printed to the terminal. I am using this code to load successfully from an exe, it only fails from being called from a shared library.
After the handle open fails, printfdlerror with a newline. The newline will force the buffer to flush. If you don't get a message but it still fails, you're probably getting a signal. Have main return 0 for success and 1 for error. If it's an abnormal termination then the return will be some other number. My guess is that the library isn't in the library path. If it's local to the directory, try placing ./ before it. Otherwise libdl will look in the library path.
ta0kira
Thanks again for your reply. I think I have now got to the bottom of this problem. I have been using a USB booting build of Slackware 12 made using the Linux-Live scripts. These utilise a new filesystem AUFS and when I move my code from AUFS to an ext2fs partioned part of my flash drive all is (almost) well! I seem to be getting lots of problems with AUFS with reading and writing to files as well as loading libraries, so I shall move a fresh set of source code directly to my ext2 partition and see how it goes.
I get a similar problem where ofstream hangs when called from the thread on RHEL5. RHEL3 it works correctly.
Has any faced similar problems?
please advise.... we are in process of porting our code and got stuck on this
I get a similar problem where ofstream hangs when called from the thread on RHEL5. RHEL3 it works correctly.
Has any faced similar problems?
please advise.... we are in process of porting our code and got stuck on this
Please start another thread and post information about the problem and circumstances in which you have the problem. As of now all we know is "ofstream hangs" on "RHEL5", that is not enough information to help in any meaningful way.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.