Hello, I tried to use a connect signal of a button having the “missing slot” common error. I read many threads and examples regarding how to bypass the VS linker limitation using rootcint so at the end I:
Splitted my class file in header (declaration, C_SerialC.h) and implementation (definition C_SerialC.cpp)
made a file LinkDef.h
made a bat mainly run rootcint -f dict.Cxx -c C_SerialC.h LinkDef.h
now I tried to #include dict.Cxx before headers, before class definition and after but i always have compiling problems. Where is the mistake?
PS OT: I come from a higher level language so I currently don’t know most of technical details of regarding compiler-linker etc but:
Is theren’t a way to simplify root programming under winzozz? Since root package has its linker and compiler shouldn’t be enough to add a simple text editor correctly linked to root?
Your options give me the error: “Error in TQObject::CheckConnectArgs: slot updateSerialPort() does not exist”
D:\OscilloC\OscilloC>rootcint -f dict.Cxx -c C_SerialC.h LinkDef.h
D:\OscilloC\OscilloC>cl -MD -GR -EHsc -I%ROOTSYSD%\include OscilloC.cpp dict.Cxx /link -LIBPATH:%ROOTSYSD%\lib libCore.lib libCint.lib libRIO.lib libNet.lib libHist.lib libGraf.lib libGpad.lib libRint.lib libMatrix.lib libMathCore.lib libGui.lib /out:OscilloC.exe
Microsoft (R) C/C++ Optimizing Compiler versione 18.00.40629 per x86
Copyright (C) Microsoft Corporation. Tutti i diritti riservati.
OscilloC.cpp
dict.Cxx
Generazione del codice in corso...
Microsoft (R) Incremental Linker Version 12.00.40629.0
Copyright (C) Microsoft Corporation. All rights reserved.
/out:OscilloC.exe
-LIBPATH:C:\root_v5.34.36D\lib
libCore.lib
libCint.lib
libRIO.lib
libNet.lib
libHist.lib
libGraf.lib
libGpad.lib
libRint.lib
libMatrix.lib
libMathCore.lib
libGui.lib
/out:OscilloC.exe
OscilloC.obj
dict.obj
Creazione della libreria OscilloC.lib e dell'oggetto OscilloC.exp in corso...
From the little I understand i compiled both files but i missed where you linked the second to the first.
On the other hand can you explain a little better (or link some documentation) what I should include? Using rootcint i made dict.h and dict.cxx, that must be compiled first and linked explicitly last? **Can you explain me also how to handle it directly in VS without the command line? **
And could you provide the necessary files to reproduce the issue? And creating a VS solution for such a little project is an overkill… I’ll come with an explanation nevertheless (even if the command line is much, much simpler)
I read the MS docs regarding cl and the only info i had is that /link override default parameters for linker with defined one, and in the one you defined i didn’t find anything regarding dict.
Here the project, and thanks for help. OscilloC.zip (20.2 KB)
Add rootcint -f dict.Cxx -c C_SerialC.h LinkDef.hin the Pre-Build Event of the Build Events, in the Configuration Properties of your project
remove the #include "Windows4Root.h" from header.h
Make sure the build type matches the ROOT build type (debug/release), and even if you build in debug mode, link against the release runtime libraries (use the /MD flag instead of /MDd)
Enable Run-Time Type Information (/GR)
No need to use precompiled headers
Add all the headers and all the source in the project
Don’t exclude any source file from build
In OscilloC.cpp, use #include "C_SerialC.h" instead of #include "C_SerialC.cpp"
Finally, in LinkDef.h, replace #ifdef CINT by #ifdef __CINT__
(I told you that the command line option would be simpler…)
And let me know if you manage to build it… (it works for me, it just complains: unable to read resistors.csv)
You are right, I simplified too much the example. In any case I want to add other code in the exit function; I’m also going to define GUI and interaction directly in the main function so i need a more flexible usage of slots.
Then you have to generate a dictionary for the functions you want to use in your signal/slots, by adding the declaration in the C_SerialC.h header, and adding the following #pragma in your linkdef.h file