Incompatiblity of the code due to CC compiler version mismatch.


 
Thread Tools Search this Thread
Top Forums Programming Incompatiblity of the code due to CC compiler version mismatch.
# 29  
Old 02-14-2013
Whether it is a .so shared and dynamic library, a .a static library or a .o static object file, you need prototypes and such. A .h may support several subroutines, which maybe all or part of a library. It's nice to try to keep the sizeof the .h down, generally. For something like a RDBMS access library, there is often one include file, but it can include many others. That's very convenient, but the .h files can be kept small.

If the actual memory consuming objects are instantiated in the library not the .h, you can include excess .h files with no runtime cost, as the linker will only pull in the dynamic objects the code actually uses.

Not only are .so files dynamically linked, they are memory mapped and the ram pages that support them are shared by all linked processes. That is why the mnemonic is shared object. It saves ram and increases cache hit rates. You can even find ways to put main() in the shared library - code can look at the name it was exec()'d on, so 100 processes can run the same main() (one per library).

Last edited by DGPickett; 02-14-2013 at 02:12 PM..
# 30  
Old 02-14-2013
I can't see how the problem can be missing prototypes. That wouldn't get "symbol not found" errors on basic things like "operator delete( void * )" at final link time.

Missing prototypes should fail at compile time, not link time.

It's like he's linking against the wrong C++ runtime. Maybe that's the problem? A way out-of-date C++ runtime?
# 31  
Old 02-15-2013
Well, begin at the beginning. cerr is really std::cerr cerr - C++ Reference

Someone has to say use std somewhere. C++ Basic Input/Output
Code:
The standard error stream (cerr):
 
The predefined object cerr is an instance of ostream class. The cerr object is said to be attached to the standard error device, 
which is also a display screen but the object cerr is un-buffered and each stream insertion to cerr causes its output to appear immediately.
 
The cerr is also used in conjunction with the stream insertion operator as shown in the following example.
 
#include <iostream> 
using namespace std; 
int main( ){
    char str[] = "Unable to read....";
    cerr << "Error message : " << str << endl;
}
 
When the above code is compiled and executed, it produces following result:
 
Error message : Unable to read....


My cerr declaration lookup:
Code:
CScope WWW 201211
 
Find this C symbol: 'cerr'
  /opt/aCC/include/iostream/iostream.h  <global>            626  extern ostream_withassign cerr ;
  /opt/aCC/include/iostream/iostream.h  <global>            780  #define cerr ((ostream_withassign&)__tcerr)

# 32  
Old 02-16-2013
OK, what does the mangled name look like in whatever C++ runtime the OP's link step is looking in? And what's the mangled name in his object files?
# 33  
Old 02-17-2013
The nm command will tell you: Man Page for nm (opensolaris Section 1) - The UNIX and Linux Forums

I never care what mangled names are for the past couple decades or so, as I am generally satisfied that they are mangled in C++ and 'extern "C++" { ... }', and not in C or 'extern "C" { ... }', and if the mangling and arguments and return and name are right, they link.
# 34  
Old 02-19-2013
You may not care how the mangled names are created and what they look like, but the linker sure does.

Hence the OP's error messages.
# 35  
Old 02-19-2013
Well, mangling has nothing to do with linkage errors that looking at the name will solve. C++ objects are mangled, C objects are not, and we have the keys to tell the linker which is which.

The first error is cerr, which is c++ called in c++, so mangling is irrelevant. Not either defining std as the default package or using the long name meant the name did not link, for the real name is std::cerr even before mangling. Is there any contention about that? Can we see what the fixed code produces, once this line is added:
Code:
using namespace std;

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Need fix for rsync Error due to version mismatch

rsync --delay-updates -F --compress --archive --rsh='/usr/bin/ssh -t -a -x' /web/admin/Transfer/data/ user1@destserver1:/tmp/testf rsync version on sender server is:3.0.9 rsync version on sender server is:3.0.6 Linux sourceserver1 3.10.0-693.17.1.el7.x86_64 #1 SMP Sun Jan 14 10:36:03 EST... (1 Reply)
Discussion started by: mohtashims
1 Replies

2. Linux

Linking issue due to so version number

Hi all, currently I'm facing a issue in linking a .so file. In my build machine, I've libcrypto.so.6 and there is a softlink as libcrypto.so. In my make file I'm trying to link to the lib using -L -lcrypto and it is success and created my test.exe. When I copy this test.exe to other... (4 Replies)
Discussion started by: vijkrr
4 Replies

3. AIX

Checking xlc compiler version

Hi, Below is output of lslpp command. bash-3.00# lslpp -L | grep xlC xlC.aix50.rte 11.1.0.1 C F XL C/C++ Runtime for AIX 5.3 xlC.cpp 9.0.0.0 C F C for AIX Preprocessor xlC.msg.en_US.cpp 9.0.0.0 C F C for AIX... (2 Replies)
Discussion started by: manoj.solaris
2 Replies

4. Programming

Choose compiler version

Hi, I'm new, here, and I'm searching for a simple solution for a simple problem. I'm working on RedHat 4.4.6-4 through a CentOS Virtual Machine and due to some reasons I must compile my C++ codes with these two different g++ versions: 4.4.6 and 4.2.2. The fact is that I should be able to... (4 Replies)
Discussion started by: Marcuss
4 Replies

5. Solaris

java version mismatch for normal user and root user

:confused: I installed latest version of java ( jre 1.6) on Solaris Machine ......when I run java -version as root, shows the latest version but when I run java -version as normal user, shows the old / previous version What should I do to fix this ...should show the latest version... (3 Replies)
Discussion started by: frintocf
3 Replies

6. AIX

install two different compiler version

Hi all. I have a simple question. There's a way to install under AIX system (5.3) two different compiler version, i.e. ibm xlf fortran 11 and 12? Seems that smitty doesn't allows user to change the default installation path; it only allows you to save the replaced files of the superseded... (1 Reply)
Discussion started by: poldo000
1 Replies

7. AIX

how to find out the compiler version and OS from binary file

Command to get the Compiler version(xlc/gcc) from the binary on AIX platform. I m searching for the Command, to get the Compiler(xlc/gcc) used to build the binary on AIX. I got two commands used on Linux Platform: - readelf -a <lib> | grep comment - hexdump -C -s 0x49e7b -n 1812 <lib> ... (1 Reply)
Discussion started by: Prajakta
1 Replies

8. UNIX for Dummies Questions & Answers

What version is the compiler?

Hi ! we have a intel fortran compiler on our computer. How do i find out what version it is ? Thank you, dsmv. (1 Reply)
Discussion started by: dsmv
1 Replies

9. Solaris

X Keyboard Extension version mismatch

I want to use calls from the X Keyboard Extension, but get "library version mismatch" error. First one is XkbLibraryVersion(..). This one already returns false. Then I call XkbOpenDisplay(...) which does not return a valid display; return value is XkbOD_NonXkbServer. If I open the display with... (0 Replies)
Discussion started by: hiker04
0 Replies

10. UNIX for Dummies Questions & Answers

gcc compiler version?

How do you determine which version of the GNU gcc compiler is on your system? (1 Reply)
Discussion started by: Ben070371
1 Replies
Login or Register to Ask a Question