1

I have a structure of C++ .so file like this: (dynamic library)

Folder 1 (.d and .o extention files) Folder 2 (.d and .o extention files) Folder 3 (.d and .o extention files) processsignal.so makefile objects sources... 

Do you guys know how to compile and run the files above, I tried to compile .so and also ran the makefile, however it remains an error:

make: make: Nothing to be done for `Cartographie/ProcessingFit.d'. 

Compiling by G++ :

g++ libsignalProcessing.so /usr/lib/gcc/i686-linux-gnu/4.6/../../../i386-linux-gnu/crt1.o: In function `_start': (.text+0x18): undefined reference to `main' collect2: ld returned 1 exit status 
7
  • What kind of file is the one with .d extension ? Commented May 30, 2013 at 9:29
  • Is processsignal.so the result of the compilation or a library needed to compile your program ? Commented May 30, 2013 at 9:30
  • 3
    From your question it is not clear which files are your, which are provided by somebody else, which are generated by build system, which kind of build system etc. Apparently you are trying to build an executable (not a library, shared nor static) and don't have main function, but until you clarify what you are doing, it can't be really said how to fix it. Oh, and mention your build system (is it automake? or cmake? or just plain hand-written makefiles?) Commented May 30, 2013 at 9:31
  • are you trying to compile a dynamic library? the output is .so, and perhaps you already created it so there's nothing to do... Commented May 30, 2013 at 9:37
  • Actually, I have been given those files, and Im also new to Linux and lib in Linux, yes, I actually guessed that I already have a file, so now I have to make a program that uses this lib ? Commented May 30, 2013 at 9:42

1 Answer 1

1

If you want to use the .so file in your program, you need to use the -l flag of gcc compiler. Before you do that, you need to set the LD_LIBRARY_PATH to the location of the .so

For example, if you have libsomelib.so in /home/code directory then set the LD_LIBRARY_PATH as LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/code and then export LD_LIBRARY_PATH. Test it with echo $LD_LIBRARY_PATH. It should give the library location.

Then in the program where you wish to use this .so, do g++ -L ../code abc.cpp -lsomelib

I am not sure about your production code here, but this is in general that if your program is used as library, then it might not have an entry point that is the main function.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.