Compiling C ++ - Programs with Multiple Files

I am trying to compile a C ++ program with multiple files!

mainfile.cc

#include<iostream> #include "funcfile.hh" int main() { init(); } 

funcfile.hh

 #include<iostream> void init(); 

funcfile.cc

 #include<iostream> #include "funcfile.hh" using namespace std; void init() { cout<<"hi"<<endl; } 

I am creating a binary as shown below:

 > CC funcfile.cc mainfile.cc -o output funcfile.cc: mainfile.cc: ld: warning: symbol .dynsym[19] has invalid section index; ignored: (file /usr/local/opt/SunWorkShop/sws_5.0/SUNWspro/lib/libm.so value=19); 

And when I execute the output:

 > ./output hi > 

But my concern here is that I have to take care of the message at compile time:

 ld: warning: symbol .dynsym[19] has invalid section index; ignored: (file /usr/local/opt/SunWorkShop/sws_5.0/SUNWspro/lib/libm.so value=19); 

CC Version:

 > CC -V CC: WorkShop Compilers 5.0 98/12/15 C++ 5.0 
+4
source share
1 answer

You are using a compiler that is almost 15 years old. The ELF format has changed a bit during this time, it seems that your compiler does not recognize some new indexes of special sections (see, for example, here, table 7-4 ). This warning has nothing to worry about, but I would suggest using a newer compiler if possible.

+1
source

Source: https://habr.com/ru/post/1489408/


All Articles