[SOLVED] MACOSX - Linker issue (ld: library not found)

General questions regarding the usage of CodeLite
Raymi
CodeLite Curious
Posts: 6
Joined: Mon May 15, 2017 2:57 pm
Genuine User: Yes
IDE Question: c++
Contact:

[SOLVED] MACOSX - Linker issue (ld: library not found)

Post by Raymi »

Hello,

I am newbie with CodeLite, but not sure it is a CodeLite problem as the problem also occurs with xcode when using the provided command. It looks like the compiler doesn't find the static lib (nLib_utils.a), however it well exists as it has been successfully compiled.

The error occurs when trying to build a console executable on MACOSX, the static lib header just contains standards:

Code: Select all

#include <iostream>
#include <string>
#include <clocale>
#include <ctime>
#include <unistd.h>
In the console executable, the header contains:

Code: Select all

#include "nLib_utils.h"
Command & output:

Code: Select all

/Applications/Xcode.app/Contents/Developer/usr/bin/g++ -o /Output/StandAlone_Bin/OSX/Debug/Test_UT /Output/StandAlone_Bin/OSX/Debug/main.cpp.o   -L. -L/Output/Libs/OSX/Debug  lnLib_utils
ld: library not found for -lnLib_utils
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [/Output/StandAlone_Bin/OSX/Debug/Test_UT] Error 1
Using -v to see invocation produces somehow the same result.

Many thanks in advance for any help
Last edited by Raymi on Mon May 22, 2017 6:46 pm, edited 1 time in total.
Raymi
CodeLite Curious
Posts: 6
Joined: Mon May 15, 2017 2:57 pm
Genuine User: Yes
IDE Question: c++
Contact:

Re: MACOSX - Linker issue (ld: library not found)

Post by Raymi »

For those who might be facing the same issue, just ensure your static library file name starts with "lib" and ends up with ".a".
Post Reply