4

I'm pretty new to c programming and want to port a windows c application to linux. My code uses a .lib file va_g729.lib - is it possible to use the same library in Linux and compile it with gcc?

All my .c and .h files along with the one .lib files are in the same directory. What I'm doing now is executing this command in the directory:

gcc *.c -lm

and I get following errors:

lbcodec2.c:(.text+0xa6b): undefined reference to `va_g729a_init_encoder'
lbcodec2.c:(.text+0xa83): undefined reference to `va_g729a_encoder'
collect2: error: ld returned 1 exit status

Is it possible to link the .lib file and compile with gcc?

Thanks.

1
  • 1
    lib files seem to be Windows specific. On Linux static library is .a and shared library is .so. Or I'm wrong. Commented Nov 6, 2013 at 4:35

2 Answers 2

3

Seems like we can not compile the .lib file. I had to compile a .a file for linux from the source code.

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

Comments

0
gcc *.c -lm -lYourFile.lib -o yourExecutable

you might have to explicitly link your .lib file.

1 Comment

The .lib file is in my working direcoty, gcc does not find it. I tried explicityly mentioning the path with: gcc *.c -lm -lva_g729.lib -L/home/shantanu/workspace/ConverterTest/src Still gcc can not find and says: /usr/bin/ld: cannot find -lva_g729.lib collect2: error: ld returned 1 exit status

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.