[Qt-interest] Problem perl into Qt Programme

yogesh upreti yogesh.upreti at gmail.com
Fri Apr 29 00:06:49 CEST 2011


Hi,
Thanks, it helped. I have to add -lperl510.
My programme is still not working but I solved the issue with compiling.

Regds,
Yogesh Upreti



> ---------- Forwarded message ----------
> From: Pascal Patry <iscy at invalidip.com>
> To: qt-interest at qt.nokia.com
> Date: Thu, 28 Apr 2011 16:24:53 -0400
> Subject: Re: [Qt-interest] Problem perl into Qt Programme
> On Thursday, April 28, 2011 16:10:41 yogesh upreti wrote:
> > Hello All,
> >
> > I am trying to run some perl command in my Qt programme.
> > I made a test programme according to
> >
> http://perldoc.perl.org/perlembed.html#Adding-a-Perl-interpreter-to-your-C-
> > program
> >
> > in my .pro file I have
> >
> > #-------------------------------------------------
> >
> > #
> >
> > # Project created by QtCreator 2011-04-27T23:08:23
> >
> > #
> >
> > #-------------------------------------------------
> >
> >  QT       += core gui
> >
> >  TARGET = testProcess
> >
> > TEMPLATE = app
> >
> >  SOURCES += main.cpp\
> >
> >         testprocess.cpp
> >
> >  HEADERS  += testprocess.h
> >
> >  FORMS    += testprocess.ui
> >
> >  INCLUDEPATH += C:/Perl/lib/CORE
> >
> >  LIBS += -LC:/Perl/lib/CORE
>
> Look at your "LIBS" right here.
> -L <= adds the path for the linker
> -l <= adds the library itself to tell the linker to link it
>
> > [...]
> >
> D:\Work\Programming\QT\testProcess-build-desktop/../testProcess/testprocess
> > .cpp:20: undefined reference to `Perl_sys_term'
> >
> > collect2: ld returned 1 exit status
>
> Since the linker doesn't know which library to link with, none of these
> functions (Perl_sys_term & others) are defined at link time. I'm not
> sure what's the name of your library should be, but something like this
> might work better:
>
> LIBS += -LC:/Perl/lib/CORE \
>                -lperlcore
>
>
> this is *IF* the library is called "perlcore"
>
>
>
>
>
> ---------- Forwarded message ----------
> From: Karl Ruetz <karl.ruetz at sototech.com>
> To: qt-interest at qt.nokia.com
> Date: Thu, 28 Apr 2011 15:37:24 -0500
> Subject: Re: [Qt-interest] Problem perl into Qt Programme
>  Your "LIBS" line in the .pro file is missing the library's name.
> ex: LIBS ++ -LC:/Perl/lib/CORE -lperl  (if the library is named
> libperl.dll)
>
> Karl
> On 4/28/2011 3:10 PM, yogesh upreti wrote:
>
> Hello All,
>
>  I am trying to run some perl command in my Qt programme.
> I made a test programme according to
> http://perldoc.perl.org/perlembed.html#Adding-a-Perl-interpreter-to-your-C-program
>
>  in my .pro file I have
>
>  #-------------------------------------------------
>
> #
>
> # Project created by QtCreator 2011-04-27T23:08:23
>
> #
>
> #-------------------------------------------------
>
> QT       += core gui
>
> TARGET = testProcess
>
> TEMPLATE = app
>
> SOURCES += main.cpp\
>
>         testprocess.cpp
>
> HEADERS  += testprocess.h
>
> FORMS    += testprocess.ui
>
> INCLUDEPATH += C:/Perl/lib/CORE
>
> LIBS += -LC:/Perl/lib/CORE
>
>
>  Where C:\Perl is where I have my perl installed.
>
>  my .cpp file looks like:
>
>  #include "testprocess.h"
>
> #include "ui_testprocess.h"
>
> #include <perl.h>
>
> #include <EXTERN.h>
>
> testProcess::testProcess(QWidget *parent) :
>
>     QMainWindow(parent),
>
>     ui(new Ui::testProcess)
>
> {
>
>     ui->setupUi(this);
>
>     char *lines[2] = {"printf \"My Name is\\n\";", "printf \"Yogesh Upreti\""};
>
>     static PerlInterpreter *my_perl;
>
>     my_perl = perl_alloc();
>
>     perl_construct(my_perl);
>
>     ui->output->insertPlainText("Start perl\n");
>
>     int i = 0;
>
>     i = perl_parse(my_perl,NULL,2,lines,(char**)NULL);
>
>     perl_destruct(my_perl);
>
>     perl_free(my_perl);
>
>     PERL_SYS_TERM();
>
>     ui->output->insertPlainText(QString("Perl output : %1\n").arg(i));
>
> }
>
> testProcess::~testProcess()
>
> {
>
>     delete ui;
>
> }
>
>
>  When i start writing this code, my QtCreator is identifying perl.h and
> EXTERN.h. Also it gives me hint for all the functions (perl_alloc(),
> per_parse() etc etc)
>
>  But when I run the program, I got following message.
>
>  Running build steps for project testProcess...
>
>  Configuration unchanged, skipping qmake step.
>
> Starting: "C:/QtSDK/mingw/bin/mingw32-make.exe" -w
>
> mingw32-make: Entering directory
> `D:/Work/Programming/QT/testProcess-build-desktop'
>
> C:/QtSDK/mingw/bin/mingw32-make -f Makefile.Debug
>
> mingw32-make[1]: Entering directory
> `D:/Work/Programming/QT/testProcess-build-desktop'
>
> g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE
> -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_HAVE_MMX
> -DQT_HAVE_3DNOW -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAVE_SSE2
> -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN
> -I'c:/QtSDK/Desktop/Qt/4.7.2/mingw/include/QtCore'
> -I'c:/QtSDK/Desktop/Qt/4.7.2/mingw/include/QtGui'
> -I'c:/QtSDK/Desktop/Qt/4.7.2/mingw/include' -I'c:/Perl/lib/CORE'
> -I'c:/QtSDK/Desktop/Qt/4.7.2/mingw/include/ActiveQt' -I'debug' -I'.'
> -I'../testProcess' -I'.'
> -I'c:/QtSDK/Desktop/Qt/4.7.2/mingw/mkspecs/win32-g++' -o debug/testprocess.o
> ../testProcess/testprocess.cpp
>
> In file included from c:/Perl/lib/CORE/perl.h:38,
>
> from ../testProcess/testprocess.cpp:3:
>
> c:/Perl/lib/CORE/config.h:39:20: warning: "/*" within comment
>
> .....
>
> ../testProcess/testprocess.cpp: In constructor
> 'testProcess::testProcess(QWidget*)':
>
> ../testProcess/testprocess.cpp:11: warning: deprecated conversion from
> string constant to 'char*'
>
> ../testProcess/testprocess.cpp:11: warning: deprecated conversion from
> string constant to 'char*'
>
> g++ -enable-stdcall-fixup -Wl,-enable-auto-import
> -Wl,-enable-runtime-pseudo-reloc -mthreads -Wl -Wl,-subsystem,windows -o
> debug/testProcess.exe debug/main.o debug/testprocess.o
> debug/moc_testprocess.o -L'c:/QtSDK/Desktop/Qt/4.7.2/mingw/lib' -lmingw32
> -lqtmaind -LC:/Perl/lib/CORE -lQtGuid4 -lQtCored4
> -LC:\OpenSSL-Win32_full\lib
>
> debug/testprocess.o: In function `testProcess':
>
> D:\Work\Programming\QT\testProcess-build-desktop/../testProcess/testprocess.cpp:13:
> undefined reference to `perl_alloc'
>
> D:\Work\Programming\QT\testProcess-build-desktop/../testProcess/testprocess.cpp:14:
> undefined reference to `perl_construct'
>
> D:\Work\Programming\QT\testProcess-build-desktop/../testProcess/testprocess.cpp:17:
> undefined reference to `perl_parse'
>
> D:\Work\Programming\QT\testProcess-build-desktop/../testProcess/testprocess.cpp:18:
> undefined reference to `perl_destruct'
>
> D:\Work\Programming\QT\testProcess-build-desktop/../testProcess/testprocess.cpp:19:
> undefined reference to `perl_free'
>
> D:\Work\Programming\QT\testProcess-build-desktop/../testProcess/testprocess.cpp:20:
> undefined reference to `Perl_sys_term'
>
> D:\Work\Programming\QT\testProcess-build-desktop/../testProcess/testprocess.cpp:13:
> undefined reference to `perl_alloc'
>
> D:\Work\Programming\QT\testProcess-build-desktop/../testProcess/testprocess.cpp:14:
> undefined reference to `perl_construct'
>
> D:\Work\Programming\QT\testProcess-build-desktop/../testProcess/testprocess.cpp:17:
> undefined reference to `perl_parse'
>
> D:\Work\Programming\QT\testProcess-build-desktop/../testProcess/testprocess.cpp:18:
> undefined reference to `perl_destruct'
>
> D:\Work\Programming\QT\testProcess-build-desktop/../testProcess/testprocess.cpp:19:
> undefined reference to `perl_free'
>
> D:\Work\Programming\QT\testProcess-build-desktop/../testProcess/testprocess.cpp:20:
> undefined reference to `Perl_sys_term'
>
> collect2: ld returned 1 exit status
>
> mingw32-make[1]: Leaving directory
> `D:/Work/Programming/QT/testProcess-build-desktop'
>
> mingw32-make: Leaving directory
> `D:/Work/Programming/QT/testProcess-build-desktop'
>
> mingw32-make[1]: *** [debug/testProcess.exe] Error 1
>
> mingw32-make: *** [debug] Error 2
>
> The process "C:/QtSDK/mingw/bin/mingw32-make.exe" exited with code %2.
>
> Error while building project testProcess (target: Desktop)
>
> When executing build step 'Make'
>
>  Do anyone see something I am missing?? any keyword to be included??
> Or anyother way to run perl programme step by step from my Qt program?
>
>  PS: I don't wanna use System command, I want to somehow collect the code
> from user and run it and use its output for further processing.
>
>  Thanks in advance.
>
>  Yogesh Upreti
>
>
> _______________________________________________
> Qt-interest mailing listQt-interest at qt.nokia.comhttp://lists.qt.nokia.com/mailman/listinfo/qt-interest
>
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at qt.nokia.com
> http://lists.qt.nokia.com/mailman/listinfo/qt-interest
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110429/495b2184/attachment.html 


More information about the Qt-interest-old mailing list