Hi I am trying to start with internationalisation using gettext string extractor.
I have created sample code as follows. But it failed to build.
#include "SupportLanguage.hpp"
#include <iostream>
#include <locale.h>
#define _(STRING) gettext(STRING)
#include "libintl.h"
using namespace std;
class SupportLanguage {
public:
int x = 0;
void display();
};
void SupportLanguage :: display(){
cout << " Hello World" << endl;
cout<< "Welcome" <<endl;
cout << gettext("How are you doing ?") <<endl;
}
int main(){
SupportLanguage sl ;
sl.display();
return 0;
}
Error Message:
Ld DerivedData/Internationalise/Build/Products/Debug/Internationalise.app/Contents/MacOS/Internationalise normal x86_64
cd /Users/UserName/WorkPlace/Internationalise
export MACOSX_DEPLOYMENT_TARGET=10.11
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk -L/Users/UserName/WorkPlace/Internationalise/DerivedData/Internationalise/Build/Products/Debug -F/Users/UserName/WorkPlace/Internationalise/DerivedData/Internationalise/Build/Products/Debug -filelist /Users/UserName/WorkPlace/Internationalise/DerivedData/Internationalise/Build/Intermediates/Internationalise.build/Debug/Internationalise.build/Objects-normal/x86_64/Internationalise.LinkFileList -Xlinker -rpath -Xlinker @executable_path/../Frameworks -mmacosx-version-min=10.11 -Xlinker -no_deduplicate -stdlib=libc++ -Xlinker -dependency_info -Xlinker /Users/UserName/WorkPlace/Internationalise/DerivedData/Internationalise/Build/Intermediates/Internationalise.build/Debug/Internationalise.build/Objects-normal/x86_64/Internationalise_dependency_info.dat -o /Users/UserName/WorkPlace/Internationalise/DerivedData/Internationalise/Build/Products/Debug/Internationalise.app/Contents/MacOS/Internationalise
Undefined symbols for architecture x86_64:
"_libintl_gettext", referenced from:
gettext(char const*) in SupportLanguage.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
OS: OS X
What is the problem here?
Thanks
What I have tried:
I hardly understand the problem.