Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
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.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
I'm c++ programmer, but fairly new to developing on linux platforms.
I am trying to build an application that uses a share library providing API implementation.
To test library linking, I have written a simplest main.cpp that calls most basic function from this shared library.
I get following error while linking main.o >>>>>>>>
$ g++ main.o -o main.exe -L /usr/lib -l :libmylib.so
/usr/lib/gcc/pc/i686-pc-cygwin/../../../libmylib.so: Could not read symbols: File in wrong format
/usr/lib/libmylib.so is symbolic link to the actual shared library.
The 'file' command gives below output >>>>>>>
$ file -L <actual lib name>
<Actual libname>: ELF 32-bit LSB shared object, Intel 80386, Version 1(SYSV), dynamically linked, stripped
Also, I can see all the functions using "nm -D" or "readelf" tools.
What might be wrong here? I am using Cygwin environment to emulate linux.
I just have one library which is .so
I don't have source code for that.
When I try static linking (-Wl,-Bstatic), the error says "Attempted static link of dynamic object <libname>"
When I try dynamic linking (-Wl,-Bdynamic), the error says "Could not read symbols: File in wrong format".
Is this because I am using cygwin?
I don't think it should be a problem.
Yes I have the library placed in /usr/lib (I think that's what you mean by install, right?)
I'm not even trying to run the app, the problem is in the build stage.
Also, I don't need static linking, I'm good with dynamic linking.
I checked the architecture of my object (main.o) and library file - both are 32-bit.
These are some one the commands I tried, but all fail with same error
$ gcc maino -o main -L/usr/lib -lmylib
$ gcc maino -o main -L/usr/lib -l:libmylib.so
$ gcc maino -o main -L/usr/lib -Wl,-Bdynamic -l:libmylib.so
The error always says "could not read symbols: file in wrong format"
So I found the problem and it was 'cygwin' I guess.
I was under the impression that cygwin emulates linux shell and build environment on windows.
But seems compilers in cygwin build windows executable and expect windows DLLs as 'shared libraries'.
I installed coLinux with debian FS, it took me a while to figure out and fix various issues.
But it working great and I'm able to build linux binaries using coLinux.
Now I need to hunt for nice GUI based IDE for linux based c++ projects.