LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 08-08-2017, 03:07 PM   #1
Fractal Cat
LQ Newbie
 
Registered: Jul 2017
Posts: 8

Rep: Reputation: Disabled
Question Undefined references


Hi,

I'm attempting to compile some code but keep coming up with same error messages:

main.cpp:29: error: undefined reference to `ki18n(char const*)'
main.cpp:33: error: undefined reference to `KLocalizedString::~KLocalizedString()'

Now, I think this is caused by not linking in the right library. But I'm
unsure of which libraries I need to link.
Any ideas ?

I'm running Linux Mint 18 and I'm using the QTCreator IDE.

Thanks

FC.
 
Old 08-08-2017, 04:05 PM   #2
norobro
Member
 
Registered: Feb 2006
Distribution: Debian Sid
Posts: 792

Rep: Reputation: 331Reputation: 331Reputation: 331Reputation: 331
Use the link to the api (https://api.kde.org/) that Habitual provided in your previous post.
Click on "The KDE Frameworks"
Click on "KI18n".
On the left under "Use with QMake" you see "QT += KI18n"

Have you put that in your .pro file?

Last edited by norobro; 08-08-2017 at 04:25 PM. Reason: left out a step
 
Old 08-08-2017, 05:02 PM   #3
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 6,269
Blog Entries: 24

Rep: Reputation: 4196Reputation: 4196Reputation: 4196Reputation: 4196Reputation: 4196Reputation: 4196Reputation: 4196Reputation: 4196Reputation: 4196Reputation: 4196Reputation: 4196
Please place your code snippets (and compiler messages) inside [CODE]...[/CODE] tags for better readability. You may type those yourself or click the "#" button in the edit controls.

In addition to learning your way around the API, it is often helpful to search for the essential part of the error itself as a first step in troubleshooting messages that you are not yet familiar with. In this case a quick DDG for "undefined reference to ki18n" turns up several pages specific to this question, including this one, Getting Started/Build/Troubleshooting.
 
Old 08-08-2017, 05:57 PM   #4
Fractal Cat
LQ Newbie
 
Registered: Jul 2017
Posts: 8

Original Poster
Rep: Reputation: Disabled
Undefined references

Hi,

I still have problems:

Here is my .pro file

QT -= gui
QT += KI18n

CONFIG += c++11

TARGET = KD5Test
CONFIG += console
CONFIG -= app_bundle

TEMPLATE = app

SOURCES += main.cpp

# The following define makes your compiler emit warnings if you use
# any feature of Qt which as been marked deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
# DEFINES += QT_DEPRECATED_WARNINGS

# You can also make your code fail to compile if you use deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0

INCLUDEPATH += /usr/include
INCLUDEPATH += /usr/include/qt4
INCLUDEPATH += /usr/include/KDE
# INCLUDEPATH += /usr/share/locale/uk/LC_MESSAGES

And in the General Message window:

Project ERROR: Unknown module(s) in QT: KI18n
 
Old 08-09-2017, 02:18 AM   #5
Jjanel
Member
 
Registered: Jun 2016
Distribution: any&all, in VBox; Ol'UnixCLI; NO GUI resources
Posts: 999
Blog Entries: 12

Rep: Reputation: 364Reputation: 364Reputation: 364Reputation: 364
Might a ki18n pkg be needed? Here's a simpler explanation of CODE tags.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] problems compiling -- undefined references mohammad taqy bayat Linux - Newbie 1 08-12-2014 04:37 AM
Issues with undefined references and linking in WordNet Kanangill Linux - Newbie 4 01-20-2011 09:19 AM
Undefined references with static libraries Nightfox Programming 2 10-28-2005 06:43 PM
texinfo - undefined references during make fitret Linux - Software 1 06-18-2005 02:38 PM
Qt 3.3.3 undefined references when linking Ch. 7 tutorial QtCoder Programming 3 11-07-2004 11:59 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:00 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration