QtDBus in .pro brokeCONFIG += force_debug_info? - qt-creator

I have a qmake/qtcreator c++ project, i set CONFIG += separate_debug_info force_debug_info in my pro file and myapp.debug was generated, today i add QT += dbus and debug file isn't generated.
I checked the diff with my last and ok backup, here it's
--- /home/eric/rpmbuild/SOURCES/QtVsPlayer-1.0.19/QtVsPlayer/QtVsPlayer.pro
+++ /home/eric/Projets/qt/QtVsPlayer/QtVsPlayer.pro
## -1,10 +1,10 ##
-VERSION = 1.0.19
+VERSION = 1.0.20
DEFINES += APP_VERSION=\\\"$$VERSION\\\"
-QT += core gui opengl multimedia multimediawidgets
+QT += dbus core gui opengl multimedia multimediawidgets
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
-CONFIG += c++11 link_prl
+CONFIG += c++11 link_prl static #separate_debug_info # debug_and_release
# Specifies name of the binary.
TARGET = QtVsPlayer
## -85,6 +85,9 ##
settingsform.ui \
videoctrls.ui
+DBUS_ADAPTORS += local.QtVsPlayer.xml
+DBUS_INTERFACES += local.QtVsPlayer.xml
+
TRANSLATIONS += \
QtVsPlayer_fr_FR.ts

Answer myself but not understand!
it is the bad boy!
with 
+CONFIG += static
debug file isn't generated!

Related

Qt and Tesseract Linkage

How can i amend the pro file to make the program work?
Googled a lot about QT and Tesseract, could not find a solution yet.
Please advise
Code:
#include <tesseract/baseapi.h>
#include <leptonica/allheaders.h>
using namespace std;
int main()
{
char *outText;
tesseract::TessBaseAPI *api = new tesseract::TessBaseAPI();
// Initialize tesseract-ocr with English, without specifying tessdata path
if (api->Init(NULL, "eng")) {
fprintf(stderr, "Could not initialize tesseract.\n");
exit(1);
}
// Open input image with leptonica library
Pix *image = pixRead("/usr/src/tesseract/testing/phototest.tif");
api->SetImage(image);
// Get OCR result
outText = api->GetUTF8Text();
cout << ("OCR output:\n%s", outText);
// Destroy used object and release memory
api->End();
delete api;
delete [] outText;
pixDestroy(&image);
return 0;
}
my pro file:
QT += core
QT -= gui
CONFIG += c++11
TARGET = openCV
CONFIG += console
CONFIG -= app_bundle
TEMPLATE = app
INCLUDEPATH += C:\opencv\release\install\include
LIBS += C:\opencv\release\bin\libopencv_core455.dll
LIBS += C:\opencv\release\bin\libopencv_highgui455.dll
LIBS += C:\opencv\release\bin\libopencv_imgcodecs455.dll
LIBS += C:\opencv\release\bin\libopencv_imgproc455.dll
LIBS += C:\opencv\release\bin\libopencv_calib3d455.dll
LIBS += C:\opencv\release\bin\libopencv_features2d455.dll
LIBS += C:\opencv\release\bin\libopencv_video455.dll
LIBS += C:\opencv\release\bin\libopencv_videoio455.dll
LIBS += -L"(C:\Program Files(x86)\Tesseract-OCR)" -ltesseract
INCLUDEPATH += /usr/include/tesseract
INCLUDEPATH += C:\Program Files(x86)\Tesseract-OCR)
LIBS += C:\Program Files(x86)\Tesseract-OCR)
LIBS +=-LC:\Program Files(x86)\Tesseract-OCR)
-ltesseract.dll
-llept.dll
LIBS += -LC:\Qt\opencv_cv2\OPENCV1\build-qt\lib
-lopencv_calib3d249d
-lopencv_contrib249d
-lopencv_core249d
-lopencv_features2d249d
-lopencv_flann249d
-lopencv_gpu249d
-lopencv_highgui249d
-lopencv_imgproc249d
-lopencv_legacy249d
-lopencv_ml249d
-lopencv_nonfree249d
-lopencv_objdetect249d
-lopencv_ocl249d
-lopencv_photo249d
-lopencv_stitching249d
-lopencv_superres249d
-lopencv_ts249d
-lopencv_video249d
-lopencv_videostab249d
SOURCES += main.cpp
DEFINES += QT_DEPRECATED_WARNINGS

Qmake Command to copy directory and files

I want to copy the contents in directory "temp" to "dd"
BINARY_DESTINATION_PATH = $$PWD$$SEPARATOR/dd/
RESOURCE_SOURCE_PATH = $$PWD$$SEPARATOR/temp
EXPORTED_DESTINATION_PATH = $${BINARY_DESTINATION_PATH}
EXPORTED_DESTINATION_PATH ~= s,/,\\,g
EXPORTED_SOURCE_PATH = $${RESOURCE_SOURCE_PATH}
EXPORTED_SOURCE_PATH ~= s,/,\\,g
QT += core
QT -= gui
CONFIG += c++11
TARGET = sample
CONFIG += console
CONFIG -= app_bundle
TEMPLATE = app
SOURCES += main.cpp
win32 {
QMAKE_POST_LINK += $$quote(cmd /c xcopy /S /I /Y $${EXPORTED_HEADERS}\\copy_to_output $${EXPORTED_HEADERS_WIN})
}
but this is not adding the files into dd and showing error on build.
Error i son line "QMAKE_POST_LINK"
quote(string)
Converts a whole string into a single entity and returns the result. This is just a fancy way of enclosing the string into double quotes.
What you're probably looking for is system(command).

Qt doesnt find the environement variable set in bash

I have a camera which I'm connecting to it thought its own APIs. To get a working code the camera manual has suggested to add these environment variables into the system.
I've set the following in the /etc/bash.bashrc
export PYLON_ROOT=/opt/pylon3
export GENICAM_ROOT_V2_3=${PYLON_ROOT}/genicam
mkdir -p $HOME/genicam_xml_cache
export GENICAM_CACHE_V2_3=$HOME/genicam_xml_cache
export LD_LIBRARY_PATH=${PYLON_ROOT}/lib64:${GENICAM_ROOT_V2_3}/bin/Linux64_x64:${GENICAM_ROOT_V2_3}/bin/Linux64_x64/GenApi/Generic:$LD_LIBRARY_PATH
when I run my qt code from terminal the code runs without any error. but When I run it from the Qtcreator it gives me the following error and terminate the program !
Environment Variable 'GENICAM_ROOT_V2_3' not found
I've added the environment variables code to /etc/profile too but the result were the same. why Qtcreator doesn't find my variables ?
.pro
QT += core
QT += gui
INCLUDEPATH += /opt/pylon3/include \
/opt/pylon3/genicam/library/CPP/include
LIBS += -L/opt/pylon3/lib64 \
-L/opt/GenICam_v2_3/bin/Linux64_x64 \
-L/opt/GenICam_v2_3/bin/Linux64_x64/GenApi/Generic \
-lgxapi \
-lpylonbase \
-lpylonbase-3.2.0 \
-lpylongigesupp \
-lpylonutility \
-lGCBase_gcc40_v2_3 \
-lGenApi_gcc40_v2_3 \
-llog4cpp_gcc40_v2_3 \
-lLog_gcc40_v2_3 \
-lMathParser_gcc40_v2_3 \
-lXerces-C_gcc40_v2_7 \
-lXMLLoader_gcc40_v2_3
TARGET = VLPR
CONFIG += console
CONFIG -= app_bundle
TEMPLATE = app
CONFIG += link_pkgconfig
PKGCONFIG += opencv
Mainwindow.cpp
MainWindow::MainWindow(QObject *parent) :QObject(parent)
{
Initialize_Cam();
}
void MainWindow::Initialize_Cam()
{
MonoCamThr = new MonoCamThread(this);
MonoCamThr->Stop_Disp = true;
MonoCamThr->start();
MonoCamThr->Stop_Disp = false;
}
Monocam.cpp
MonoCamThread::MonoCamThread(QObject *parent) :
QThread(parent)
{
try
{
// List of cameras
DeviceInfoList_t m_Devices; // Still empty
// Create the unique transport layer factory object
// ... create the transport layer object
// ... create and initialise Cameras
CTlFactory& TlFactory = CTlFactory::GetInstance();
ITransportLayer *pTl = TlFactory.CreateTl( Camera_t::DeviceClass() );
if ( ! pTl )
{
throw GenericException(
"Failed to create transport layer!", __FILE__, __LINE__);
}
// Get all attached cameras and exit if no camera is found
m_Devices.clear();
if ( 0 == pTl->EnumerateDevices( m_Devices ) )
{
throw GenericException(
"No camera present!", __FILE__, __LINE__);
}
if(m_Devices.size()<2)
{
while(1)
{
qDebug() << "Number of Cameras are less than 2 .... \n" ;
}
}
qDebug() << "Number of Cameras are: "<<m_Devices.size()<<" \n" ;
// Restrict number of used camera
size_t nCameras = 2;
// Create all camera devices and set up the grab threads
if(pTl->CreateDevice( m_Devices[0])->GetDeviceInfo().GetModelName())
MonoCamera = new Camera_t( pTl->CreateDevice( m_Devices[1]) );
MonoCamera->Open();
MonoCamera->PixelFormat.SetValue( PixelFormat_Mono8 );
MonoCamera->OffsetX.SetValue( 0 );
MonoCamera->OffsetY.SetValue( 0 );
MonoCamera->Width.SetValue( MonoCamera->Width.GetMax() );
MonoCamera->Height.SetValue( MonoCamera->Height.GetMax() );
}
catch( GenericException &e )
{
qDebug() << "**** An exception occurred! Desription is: " << "\n"<< " " << e.GetDescription() << "\n";
}
}
void MonoCamThread::run()
{
while(!Stop_Disp)
{
//since this part of code never runs I didn' put the code for it ....
}
}
there are other cpp files but they run after camera initialization. I fixed this error once six month ago by adding GENICAM_ROOT_V2_3 PATH location to a system file in ubuntu like .bashrc or .profile but I don't remeber the file name right now !! :((
P.S
Don't forget that this code runs in terminal and works fine ... the only problem is that Qt doesn't find the specified variable location !!!
Thanks
I'm using Qt with a similar cam. I've set "Run settings" like you can see in this image.

How to enable Box2d debug draw with Coco2d-x 3.0 beta 2

How I should enable debug draw with Cocos2d-x 3.0? There are some codes that do that with cocos2d-x 2.0 but they don't even compile on Cocos2d-x. Unfortunately I am new to both cocos2d-x and Box2d and I don't know how to port them. That would be great if you would share the method how you draw shapes.
EDIT:
I have found this:
http://blog.csdn.net/tian2kong/article/details/20386213
I have overridden the draw method of my applications main Layer like this:
void HelloWorld::draw()
{
GL::enableVertexAttribs(GL::VERTEX_ATTRIB_FLAG_POSITION);
kmGLPushMatrix();
m_world->drawDebugData();
kmGLPopMatrix();
}
And also have done this:
GLESDebugDraw *debugDraw = new GLESDebugDraw(PTM_RATIO);
m_world.SetDebugDraw(debugDraw);
uint32 flags = 0;
flags += b2Draw::e_shapeBit;
/*
flags += b2Draw::e_jointBit;
flags += b2Draw::e_centerOfMassBit;
flags += b2Draw::e_aabbBit;
flags += b2Draw::e_pairBit;
*/
debugDraw->SetFlags(flags);
And it worked! But when I addChild a sprite, the shapes stay blow my sprites. How to bring them front?
Open spotlight and search for GLES-Render.cpp. This file will be there in a path in the cocos2dx folder. Open the enclosing folder and drag the files GLES-Render.h and GLES-Render.cpp to the project.
Then add the following code in the init method
b2Draw *m_debugDraw = new GLESDebugDraw(PTM_RATIO);
uint32 flags = 0;
flags += b2Draw::e_shapeBit;
flags += b2Draw::e_jointBit;
flags += b2Draw::e_aabbBit;
flags += b2Draw::e_pairBit;
flags += b2Draw::e_centerOfMassBit;
m_debugDraw->SetFlags(flags);
H_world->SetDebugDraw(m_debugDraw);
Then add the draw method.
void HelloWorld::draw()
{
kmGLPushMatrix();
H_world->DrawDebugData();
kmGLPopMatrix();
}
Don't forget to include GLES-Render.h
You CANNOT bring bodies to front. if you want to see your bodies behind your sprites you can set their opacity as sprite->setOpacity(100).
i use the following code to draw
void GameLayer:: setPhysics() {
b2Vec2 gravity = b2Vec2(0.0f,0.0f);// Initializing World
world = new b2World(gravity);
m_debugDraw = new GLESDebugDraw( PTM_RATIO );
world->SetDebugDraw(m_debugDraw);
world->SetAllowSleeping(false);
uint32 flags = 0;
flags += b2Draw::e_shapeBit;
// flags += b2Draw::e_jointBit;
// flags += b2Draw::e_aabbBit;
// flags += b2Draw::e_pairBit;
// flags += b2Draw::e_centerOfMassBit;
m_debugDraw->SetFlags(flags);
contactListener = new MyContactListener(this);
world->SetContactListener(contactListener);
}
which is same as yours.... can you please xplain your problem a bit more
For Debug Draw You Need Two File
File Download Link
After that
Inclue that file
and create a Vaiable in .h file
GLESDebugDraw *debugDraw;
and in .ccp file
b2Vec2 gravity;
gravity.Set(0.0f, -9.8f);
this->world = new b2World(gravity);
this->debugDraw = new GLESDebugDraw(PTM_RATIO);
this->world->SetDebugDraw(debugDraw);
uint32 flags = 0 ;
flags += b2Draw::e_shapeBit ;
flags += b2Draw::e_jointBit;
// flags + = b2Draw :: e_aabbBit;
// flags + = b2Draw :: e_pairBit;
flags += b2Draw::e_centerOfMassBit;
this->debugDraw->SetFlags (flags);
in . h file
void draw(Renderer *renderer, const Mat4 &transform, uint32_t flags);
in .cpp
void HelloWorld::draw(Renderer *renderer, const Mat4 &transform, uint32_t flags)
{
Layer::draw(renderer, transform, flags);
Director* director = Director::getInstance();
GL::enableVertexAttribs(GL::VERTEX_ATTRIB_FLAG_POSITION );
director->pushMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
world->DrawDebugData();
director->popMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
}
NOW Enjoy Debug draw
You could simply add another layer above your current layer.
And you can add the code you post here in the up layer then everything should be working.

Makefile find in array

If I have something like this:
PROJECTS += path/to/first
PROJECTS += path/to/second
PROJECTS += path/to/third
and
LIBS += lib_output/first.lib
LIBS += lib_output/second.lib
LIBS += lib_output/third.lib
How could I associate the project from PROJECTS += path/to/first with LIBS += lib_output/first.lib? Is there something like a hashmap available in a makefile? Or possibility to search in an array?
You can simulate lookup tables using computed variable names and the fact that make variable names can include some special characters like dot and forward slash:
PROJECTS += path/to/first
PROJECTS += path/to/second
PROJECTS += path/to/third
LIBS += lib_output/first.lib
LIBS += lib_output/second.lib
LIBS += lib_output/third.lib
lookup.path/to/first := lib_output/first.lib
lookup.path/to/second := lib_output/second.lib
lookup.path/to/third := lib_output/third.lib
path := path/to/first
$(info ${path} -> ${lookup.${path}})
path := path/to/second
$(info ${path} -> ${lookup.${path}})
path := path/to/third
$(info ${path} -> ${lookup.${path}})
Outputs:
$ make
path/to/first -> lib_output/first.lib
path/to/second -> lib_output/second.lib
path/to/third -> lib_output/third.lib
I'm not sure if I completely understand your question, but I think the word function might be what you need (it may be a GNU make extension):
$(word 2, $(PROJECTS)) returns path/to/second,
$(word 2, $(LIBS)) returns lib_output/second.lib.

Resources