LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This 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!

Notices


Reply
  Search this Thread
Old 10-11-2011, 07:05 AM   #1
vineeth S Thayyil
LQ Newbie
 
Registered: Oct 2011
Posts: 5

Rep: Reputation: Disabled
kdevelop


how can i use KImageIO functions in kdevelop3

Last edited by vineeth S Thayyil; 10-12-2011 at 05:28 AM.
 
Old 10-14-2011, 09:36 PM   #2
rch
Member
 
Registered: Feb 2003
Location: Santa Clara,CA
Distribution: Mandriva
Posts: 909

Rep: Reputation: 48
If you meant KDE3, yes you can.
 
Old 10-15-2011, 04:23 AM   #3
vineeth S Thayyil
LQ Newbie
 
Registered: Oct 2011
Posts: 5

Original Poster
Rep: Reputation: Disabled
i am trying to develop a application in kde3.but when i use KImageIO::registerFormats() in the main function it shows error undefined referance.I have included kimageio.h in my source code
 
Old 10-16-2011, 04:18 PM   #4
rch
Member
 
Registered: Feb 2003
Location: Santa Clara,CA
Distribution: Mandriva
Posts: 909

Rep: Reputation: 48
Do you have kdelibs-devel or the equivalent devel package for your distro installed?
 
Old 10-17-2011, 12:20 AM   #5
vineeth S Thayyil
LQ Newbie
 
Registered: Oct 2011
Posts: 5

Original Poster
Rep: Reputation: Disabled
I am using kde desktop in centos 5.So all packages are installed.
 
0 members found this post helpful.
Old 10-17-2011, 10:57 AM   #6
johnsfine
LQ Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,286

Rep: Reputation: 1181Reputation: 1181Reputation: 1181Reputation: 1181Reputation: 1181Reputation: 1181Reputation: 1181Reputation: 1181Reputation: 1181
Quote:
Originally Posted by vineeth S Thayyil View Post
I am using kde desktop in centos 5.So all packages are installed.
That doesn't sound like correct reasoning.

You ought to specifically check whether that package is installed.

I also use kde desktop on Centos 5, but there is no copy of kimageio.h on my system.

I don't have rights to run yum on the Centos system I use, so I can't use the command
Code:
yum provides "*/kimageio.h"
to find out the name of the package that would need to be installed.

If you also don't have kimageio.h on your system, then use yum yourself (if you have the root password or other rights to yum) or ask the system admin to use yum to identify and install the package containing kimageio.h

If you do have kimageio.h on your system, then maybe you need some kdevelop setting to tell it where to get kimageio.h

But if the include of kimageio.h is already working, that should have declared KImageIO::registerFormats() so that would mean something else is wrong with your source code. Without seeing the relevant source code and exact error message, we can only guess.

Last edited by johnsfine; 10-17-2011 at 11:09 AM.
 
Old 10-18-2011, 03:09 AM   #7
vineeth S Thayyil
LQ Newbie
 
Registered: Oct 2011
Posts: 5

Original Poster
Rep: Reputation: Disabled
i have all the necessary packages.I am giving the source code and error
main.cpp
**********

#include "test.h"
#include <kapplication.h>
#include <kaboutdata.h>
#include <kcmdlineargs.h>
#include <klocale.h>
#include <kimageio.h>
static const char description[] =
I18N_NOOP("A KDE KPart Application");

static const char version[] = "0.1";

static KCmdLineOptions options[] =
{
// { "+[URL]", I18N_NOOP( "Document to open" ), 0 },
KCmdLineLastOption
};

int main(int argc, char **argv)
{
KAboutData about("test", I18N_NOOP("test"), version, description,
KAboutData::License_GPL, "(C) 2011 root", 0, 0, "root@localhost.localdomain");
about.addAuthor( "root", 0, "root@localhost.localdomain" );
KCmdLineArgs::init(argc, argv, &about);
KCmdLineArgs::addCmdLineOptions( options );
KApplication app;
test *mainWin = 0;

if (app.isRestored())
{
RESTORE(test);
}
else
{
// no session.. just start up normally
KCmdLineArgs *args = KCmdLineArgs:arsedArgs();

/// @todo do something with the command line args here

mainWin = new test();
app.setMainWidget( mainWin );
mainWin->show();

args->clear();
}
KImageIO::registerFormats();
// mainWin has WDestructiveClose flag by default, so it will delete itself.
return app.exec();
}

test.cpp
*************


#include "test.h"

#include <qlabel.h>

#include <kmainwindow.h>
#include <klocale.h>

test::test()
: KMainWindow( 0, "test" )
{
// set the shell's ui resource file
setXMLFile("testui.rc");

new QLabel( "Hello World", this, "hello label" );
}

test::~test()
{
}

#include "test.moc"


test.h
************

#ifndef _TEST_H_
#define _TEST_H_

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

#include <kmainwindow.h>

/**
* @short Application Main Window
* @author root <root@localhost.localdomain>
* @version 0.1
*/
class test : public KMainWindow
{
Q_OBJECT
public:
/**
* Default Constructor
*/
test();

/**
* Default Destructor
*/
virtual ~test();
};

#endif // _TEST_H_



when the program compiles it shows error

cd '/root/test/work/test/debug' && WANT_AUTOCONF_2_5="1" WANT_AUTOMAKE_1_6="1" gmake -k
gmake all-recursive
Making all in doc
Making all in .
gmake[3]: Nothing to be done for `all-am'.
Making all in en
gmake[3]: Nothing to be done for `all'.
Making all in po
gmake[2]: Nothing to be done for `all'.
Making all in src
compiling main.cpp (g++)
linking test (libtool)
main.o: In function `main':
/root/test/work/test/src/main.cpp:66: undefined reference to `KImageIO::registerFormats()'
collect2: ld returned 1 exit status
gmake[2]: *** [test] Error 1
gmake[2]: Target `all' not remade because of errors.
gmake[2]: Nothing to be done for `all-am'.
gmake[1]: *** [all-recursive] Error 1
gmake: *** [all] Error 2
*** Exited with status: 2 ***
 
Old 10-18-2011, 08:44 AM   #8
johnsfine
LQ Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,286

Rep: Reputation: 1181Reputation: 1181Reputation: 1181Reputation: 1181Reputation: 1181Reputation: 1181Reputation: 1181Reputation: 1181Reputation: 1181
Earlier I didn't deduce the important detail that you are failing to find the definition of KImageIO::registerFormats() at link time, rather than failing to find the declaration at compile time.

KImageIO::registerFormats() is defined in some .a or .so file. I've never used it myself and don't know an easy way to check online for the name of that .a or .so file.

So you need to know two things (you might already know one of these). I don't have either answer handy, but I hope clarifying the question helps:

1) What lib file contains KImageIO::registerFormats()?

2) How do you tell kdevelop to include a specific lib file when linking your program?


When you are constructing a command for ld yourself, you would use the option
-lname
to cause ld to look for and use libname.so and if it can't find that to look for and use libname.a instead. Kdevelop has some way that you can tell it to add that option when in constructs the ld command for you. But I don't know what that is.

Last edited by johnsfine; 10-18-2011 at 08:50 AM.
 
Old 10-19-2011, 04:08 AM   #9
vineeth S Thayyil
LQ Newbie
 
Registered: Oct 2011
Posts: 5

Original Poster
Rep: Reputation: Disabled
Tanks for the reply.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
kdevelop 4 icecubeflower Slackware 2 09-05-2009 08:39 AM
KDevelop and ...?! opens3000 Programming 2 10-22-2008 12:32 PM
KDevelop and QT WayneS Linux - Software 1 09-06-2006 05:23 PM
Kdevelop mp4-10 Linux - Software 0 03-16-2005 03:59 AM
Kdevelop help Neomaster Linux - General 3 06-25-2003 04:21 PM


All times are GMT -5. The time now is 09: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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration