Error in <TQObject::CheckConnectArgs>: slot XXX does not exist

Hi,

please find a ZIP files attached to this mail: it contains a small Xcode project.
With this code my intention is to simply open a window, create a pad with a graph and plot a sinusoid in it.
Later on I would be able to connect a slider to change its amplitude: here is where I have problems in getting the signal connection working.

Compiling it without -Cling (and without –CInt, of course) linker flag works but the TQObject::CheckConnctionArgs trows these errors on stderr:
Error in TQObject::CheckConnectArgs: slot DoSlider(int) does not exist
Error in TQObject::CheckConnectArgs: slot CloseApplication() does not exist

Then I added the –Cling linker flag, and got:
Error in UnknownClass::InitInterpreter(): LLVM SYMBOLS ARE EXPOSED TO CLING! This will cause problems; please hide them or dlopen() them after the call to TROOT::InitInterpreter()!
Error in TQObject::CheckConnectArgs: slot DoSlider(int) does not exist
Error in TQObject::CheckConnectArgs: slot CloseApplication() does not exist

If I uncomment the line #55 in “GUI.hpp” (“ClassDef(GUI, 0);”) and recompile then I get lots of errors:
Undefined symbols for architecture x86_64:
“GUI::Class()”, referenced from:
GUI::IsA() const in GUI.o
GUI::ShowMembers(TMemberInspector&) const in GUI.o
“GUI::Streamer(TBuffer&)”, referenced from:
vtable for GUI in GUI.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I also tried adding a “LinkRef.hpp” file and include it in “GUI.hpp” containing some #pragma directives, as I found in some old posts in the forum, but without success.

What am I doing wrong?

Best regards,

Erik

P.S. besides this issue with the signal connections everything else apparently works fine to me.

(MacBook Air - OS X El Capitan 10.11.1 - Xcode 7.1 - root_v6.05.02)
TestSine.zip (43.3 KB)

Hi,

Could you try to uncomment “ClassDef(GUI, 0);” and properly generate the dictionary for your “GUI” class using rootcling? E.g.: rootcling -f GUI_Dict.cxx -c GUI.h LinkDef.h
With LinkDef.h containing:

[code]#ifdef CINT

#pragma link off all globals;
#pragma link off all classes;
#pragma link off all functions;

#pragma link C++ class GUI;

#endif
[/code]
And BTW, if you make your GUI class inheriting from TGMainFrame (instead of containig a TGMainFrame), you wouldn’t need RQ_OBJECT(“GUI”) (which is, BTW, made for interpreted macros…)

Cheers, Bertrand.

Hi,

what you suggested solved my problems!
Actually my main problem was that I didn’t got I actually had to generate the dictionary using rootling, as you suggested. Everything now seems working (signal are connected and my slider is responding to my code) but root still complains about this:
Error in TCling::RegisterModule: cannot find dictionary module GUIDict_rdict.pcm

I put it in the same folder (GUI) where the GUIDict.cpp dictionary has been created.
I also tried to add the full path of it in the LD_LIBRARY_PATH root’s environmental variable but the message still appears.

Am I doing something else wrong?

Thanks!

Erik

Hi Erik,

As asked [url=https://root-forum.cern.ch/t/error-with-pcm-files/18991/1 Did you move the pcm files into the same directory as the shared library containing the dictionary?

Cheers, Bertrand.

Hi Bertrand,

my folder structure for this project is this one:

TestSine/
----GUI/
--------GUI.ccp
--------GUI.hpp
--------GUIDict_rdict.pcm
--------GUIDict.cpp
--------LinkDef.hpp
----TestSine/
--------main.cpp
----TestSine.xcodeproj

But now I have another problem: I regenerated the dictionary files, as like as I originally generated them, with :
rootcling -f GUIDict.cpp -c GUI.hpp LinkDef.hpp

and again have the original problem:
Error in TQObject::CheckConnectArgs: slot DoSlider(int) does not exist
Error in TQObject::CheckConnectArgs: slot CloseApplication() does not exist

plus also:
Error in TCling::RegisterModule: cannot find dictionary module GUIDict_rdict.pcm

and the code is not responding to the signals.

I have tried several time removing the GuiDict_rdict.pcm and the GUIDict.cpp files and regenerating them, but still this last issue is persisting. I have tried to clean intermediate files using the “clean” command from the Xcode menu but without success.
Reverting my project to its original state (from my repository) as it was before regenerating the files makes things working, but the first time I regenerate them it falls back in the same issue.

I don’t understand why this is happening and what I am doing wrong.

Best regards,

Erik

By trial and error I discovered that if my LinkDef.hpp file is like this:

#ifndef LinkDef_hpp
#define LinkDef_hpp

#ifdef CLING

//#pragma link off all globals;
//#pragma link off all classes;
//#pragma link off all functions;
#pragma link C++ class GUI+;

#endif

#endif /* LinkDef_hpp */

then when regenerating the dictionary files I do not get the errors:
Error in TQObject::CheckConnectArgs: slot DoSlider(int) does not exist
Error in TQObject::CheckConnectArgs: slot CloseApplication() does not exist

but only the error:
Error in TCling::RegisterModule: cannot find dictionary module GUIDict_rdict.pcm

Under this condition I can regenerate the dictionary and recompile the project as many times as I want and my code is working.

But I modify the LinkDef.hpp file as follows:

#ifndef LinkDef_hpp
#define LinkDef_hpp

#ifdef CLING

#pragma link off all globals;
#pragma link off all classes;
#pragma link off all functions;
//#pragma link C++ class GUI+;

#endif

#endif /* LinkDef_hpp */

then I have the problem I described in my previous post.

It is possible that, in the beginning of my project, I created a LinkDef.hpp file as the first one here in this post, while I subsequently modified it as shown hereby later (according to what you suggested me) and recompiled without having regenerated the dictionary: this is why I didn’t have the problem I am describing now from the beginning.

I am a little bit confused about this :slight_smile:

Best regards,

Erik

I solved my problem!

Besides what already hereby described in the previous posts, I had another problem: Xcode 7 (actually starting from Xcode 4) saves the executable file into a “/Users/Username/Library/Developer/Xcode/DerivedData” folder by default.

When launching the executable (either by double clicking on it on that location or by building and running it directly from the Xcode IDE) the stderr was telling me the following message:
Error in TCling::RegisterModule: cannot find dictionary module GUIDict_rdict.pcm

In fact the executable was not able to find the GUIDict_rdict.pcm file.
In order to have it running it was sufficient to copy that “GUIDict_rdict.pcm” file in the same folder of the executable.

For my convenience I modified the path of the DerivedData folder in Xcode by following these instructions: See: meandmark.com/blog/2011/04/xcode … you-built/

and selecting the option “Project relative location” from the Xcode File–>project settings menu, while copying the GUIDict_rdict.pcm file in that folder.

To be more precise, in case of any use for somebody else who might read this post, I summarise the sequence of things I did in order to have a code compiled under Xcode:
0. After upgrading to El Capitan (10.11.1) and upgraded to the last Xcode (7.1.1), from a Terminal shell I installed the Command line tools: xcode-select --install

  1. In Xcode I created a new project --> Command Line Tool application, selecting C++ as language
  2. I created new files as I needed (e.g. main.cpp, GUI.cpp, GUI.hpp, etc…)
  3. In a Terminal shell I executed the command:
    root-config --libs

and got:
-L/Applications/root_v6.04.08/lib -lCore -lRIO -lNet -lHist -lGraf -lGraf3d -lGpad -lTree -lRint -lPostscript -lMatrix -lPhysics -lMathCore -lThread -lpthread -stdlib=libc++ -lm -ldl

  1. Then I copied that string to the “Other Linker Flags” in the build settings pane in Xcode
  2. In a Terminal shell I executed the command:
    root-config --cflags

and got:
-pthread -stdlib=libc++ -std=c++11 -m64 -I/Applications/root_v6.04.08/include

  1. Then I copied that string to the “Other C++ flags” in the build settings pane in Xcode

  2. I have also specified: /Applications/root_v6.04.08/lib into the “Runpath search paths” in the build settings pane and: /Applications/root_v6.04.08/include into the “Header search paths”.

  3. I have created a “LinkDef.hpp” file containing:
    #ifndef LinkDef_hpp
    #define LinkDef_hpp
    #ifdef CLING
    #pragma link C++ class GUI+; // this statement is related to my “GUI” class I defined in the GUI.cpp and
    //GUI.hpp
    #endif
    #endif /* LinkDef_hpp */

  4. I created the dictionary from a Terminal shell with:
    rootcling -f GUIDict.cpp -c GUI.hpp LinkDef.hpp

  5. I added the GUIDict.cpp file to my Xcode project and copied the GUIDict_rdict.pcm (created by rootcling) in the same folder where the executable was going to be created.

  6. Compiled from Xcode everything works fine and without error messages!

P.S. Xcode under El Capitan does not see the ROOT related environment variables (as far as any other else) specified in the .bash_profile:
discussions.apple.com/thread/73 … 0&tstart=0
At the moment I could not find a better way of specifying the root base installation folder if not manually specifying it as described above.

This way the executable, as a standalone application, was able to properly find the dictionary.

Erik.

…I forgot to say that when running: “root-config --libs” the options “-Cling” and “-lGui” might not pop up.
They should be included too in the list of the “Other Linker Flags” (point 4. in the previous description), otherwise nothing works!

Erik

Hi,

FYI - you must not link against -lCling - it is dlopened by libCore.

Please use root-config --glibs if you need to link against libGui.

Cheers, Axel.