ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I'm trying to learn how to develop KDE C++ Aplications and I choose to use KDevelop (3.0 alpha 4 gideon) to help me.
I was using Larrosa's Tutorials ( devel-home.kde.org/~larrosa/tutorial/) and I was re-writing its codes in Kdevelop.
Well, the problem is that I always have the follow error when I try to build the project ( it compiles fine, the problem is the linking operation). In this case is the tutorial P4:
": undefined reference to `KHTMLPart::KHTMLPart[in-charge](QWidget*, char const*, QObject*, char const*, KHTMLPart::GUIProfile)'"
I have a similar error when I try to build my rewrited code from P3 tutorial, however it was about KFileDialog and not KHTMLPart.
I'm sure that I don't forgot any command line ( I checked it hundred of times, besides it compiles OK). The code from that I copied is ok too, because I can build it's source without any error.
I really think that's a problem about Makefile (maybe autoconf), because I create a Kdevelop project (using the option: "a simple KDE project") with the same name as the tutorial (p4). Then, I copy the sources (main.cpp, p4.h and p4.cpp). I try to build it, but I got the same error as above. However when I copy the file "Makefile.am" from the tutorial's sources to my project, it works! I try to see if there are many differences between these files, but there are many and these files and uncompreensive for me.
I also reisntall libs, devel packages, update them (to slackware current version), use kdevelop 2.15, but nothing.
So, to finish, anyone knows how can I solve this problem or, at least, anyone has follow these tutorials like me (rewriting code into Kdevelop) and had success ? What distro, gcc or kdevelop version did you use ?
but this time I got the error (Make output) :
* g++: unrecognized option `-khtmlw'
-------------------------------------------------------------------------------
I'm really confused. I was looking for a solution for this in the last three weeks. What I just want is to build a simple (VERY simple) web browser using KParts, and I found some tutorials (in the net, magazines) and all of them use the this solution:
KURL url = "http://www.kde.org";
KHTMLPart *w = new KHTMLPart();
w->openURL(url);
w->view()->resize(500, 400);
w->show();
-----------------------------------------------------------
I tried this solution many, many times (also copying the complete source froma a larrosa's tutorial - there is a link in the first post) but always with the same error:
: undefined reference to `KHTMLPart::KHTMLPart[in ... bla bla bla..
Checking more, I found that the code generated to Kdevelop 3 (gideon), when I create a project "Application Framework", use ReadOnlyPart and it is able to open URLs ( but I doesn't have success to extending it with BrowserExtension yet - the extension doesn't send the signal OpenURLRequest :- ( ).
So, just one more question:
Is KHTMLPart a obsolete object ?
Youu can see that the linking command (the last one) is quite long. So what you need to add is probably something like {B] -L/opt/kde/lib /opt/kde/lib/libkhtml.so[/B] (if it's not enough, copy more).
Thanks again, Mara. I also successful compiled the tutorial like you. The problem is when I try to create my own project using Kdevelop ( I tried gideon an 2.15).
If you want a example I did exactly the follow:
- create I "Simple KDE Application" using kdevelop . (I used the name "Z" to my project)
- make and run it . OK. A dialog showing "Hello World" appeared. Until now it's fine
- Now, in the file z.h , I put the line:
#include <khtml_part.>
-and inside class definition:
public: KHTMLPart *browser;
- I buid it again and run. No problem.
- Now in the z.cpp I replace the lines:
#include <qlabel.h>
new QLabel( "Hello World", this, "hello label" );
for
#include <qvbox.h>
QVBox *vbox = new QVBox (this);
- I also put the line:
setCentralWidget (vbox);
- build the project again (to be sure that It's still running. OK, but now I got a empty dialog (of course, vbox isn't showing anything)
Now the real test:
- below the line "QVBox * vbox = new QVBox (this); " put :
This is my z.h
-----------------------------------------------------------------------------------------
*
* Copyright (C) 2003 Marcio Roger Ferrari,,, <mrogerf@darkstar>
*/
#ifndef _Z_H_
#define _Z_H_
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <kmainwindow.h>
#include <khtml_part.h>
/**
* @short Application Main Window
* @author Marcio Roger Ferrari,,, <mrogerf@darkstar>
* @version 0.1
*/
class z : public KMainWindow
{
Q_OBJECT
public:
/**
* Default Constructor
*/
z();
this is my z.cpp
---------------------------------------------------------------------------
/*
* Copyright (C) 2003 Marcio Roger Ferrari,,, <mrogerf@darkstar>
*/
#include "z.h"
#include <qvbox.h>
#include <kmainwindow.h>
#include <klocale.h>
z::z()
: KMainWindow( 0, "z" )
{
// set the shell's ui resource file
setXMLFile("zui.rc");
QVBox *vbox = new QVBox (this);
browser = new KHTMLPart (vbox);
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.