Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » Eclipse errors seen in Ubuntu but not in MAC
Eclipse errors seen in Ubuntu but not in MAC [message #1136857] Mon, 14 October 2013 05:34 Go to next message
Manikandan Balasubramanian is currently offline Manikandan Balasubramanian
Messages: 3
Registered: October 2013
Junior Member
Hi,

I ran my C project in my eclipse in Ubuntu. I faced no compilation errors, but I am not receiving the intended result. The weird part is, the program stops in the middle of the printf statement. I suspected a seg fault in some earlier part of the program.

However when I ran the same C project in eclipse in my team mate's Laptop(MAC), it works fine with the exact intended result.

The code worked fine in both our laptops till about 2 days back and I dint freshly install anything in my laptop or changed any of the properties in my eclipse. To check this, I ran the same project in my friend's laptop(Ubuntu), and it dint run in that either.

My question here is,

Is this due to some seg fault occurring in my project. If that is the case, how is it working in eclipse in MAC ?
Is there any solution I can follow to set it right in Ubuntu ? maybe like installing some plugin specific to MAC OS's eclipse so that I can use that in my eclipse(in Ubuntu). Will that solve the purpose ?
Thanks in advance.

Regards,
Mani
Re: Eclipse errors seen in Ubuntu but not in MAC [message #1137428 is a reply to message #1136857] Mon, 14 October 2013 13:38 Go to previous messageGo to next message
David Wegener is currently offline David Wegener
Messages: 1341
Registered: July 2009
Senior Member
My guess would be that you are encountering a non-null terminated string caused by a field that isn't long enough. Many string functions continue till a null is encountered. If you copy from one string to another but don't provide an extra byte for a null at the end of the string you have a random value after the end of the string. If this is not null, it will be included as part of the string in subsequent string functions (including printf statements). Depending on the location of the string and the data following it, this could cause any number of issues. Check your code to make sure that all strings get null terminated. I would first look for any strings being passed to the printf statement where you are seeing a problem.

Since the behavior is dependent on the random value following the string, you could definitely see different results on different OSes. Compilation options on different compilers could also change the behavior.
Re: Eclipse errors seen in Ubuntu but not in MAC [message #1138196 is a reply to message #1137428] Tue, 15 October 2013 01:23 Go to previous message
Manikandan Balasubramanian is currently offline Manikandan Balasubramanian
Messages: 3
Registered: October 2013
Junior Member
Thanks for the response..

I checked my code based on your feedback. I use character buffer(with pointers) for all my strings.. and I am trying to print with the character buffer. I use strncpy and memcpy to all my strings/character pointers and I am still getting the same error..

Other weird part I observed now is I am getting errors in a normal printf statements with only one argument as in I just put it as printf("This is a abc function"); , I am receiving error in the middle of such statements.

Thanks in advance.

Regards,
Mani
Previous Topic:Remote Builds with TM/RSE
Next Topic:Cant find source file
Goto Forum:
  


Current Time: Tue Sep 23 02:33:47 GMT 2014

Powered by FUDForum. Page generated in 0.01851 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software