Hello everyone.
I'm not able to pass a struct as a reference to a function in another class in Qt.

I was able to do this on the site "https://ideone.com" as per the code below:

It worked

Qt Code:
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. struct stcTeste {
  5. string vstrNome="Oiaaaa";
  6. };
  7.  
  8. class clsRef{
  9. public:
  10. void fcDados (stcTeste &pstcTesteDados) {
  11. stcTeste stcLocal;
  12. stcLocal = pstcTesteDados;
  13. cout << stcLocal.vstrNome << endl;
  14. }
  15. };
  16.  
  17. int main() {
  18. clsRef *vobjRef = new clsRef();
  19. stcTeste stcDados;
  20. stcDados.vstrNome="Oi...";
  21. vobjRef->fcDados(stcDados);
  22.  
  23. return 0;
  24. }
To copy to clipboard, switch view to plain text mode 

Already in Qt the code below returns the following error:

Does not work !!!

Qt Code:
  1. //Arquivo : clsteste.h
  2.  
  3. class clsTeste : public QWidget
  4. {
  5. Q_OBJECT
  6. public:
  7. explicit clsTeste(QWidget *parent = nullptr);
  8.  
  9. struct stcInfoXml
  10. {
  11. QString vstrNome = "Oiaaaa";
  12. };
  13.  
  14. void fcSalvarCadastroEmpresaDBXml(QString &pstrCadEmpresa, stcInfoXml &pstcInfoXmlDados);
  15. };
  16.  
  17. //Arquivo : clsteste.cpp
  18.  
  19. #include "clsteste.h"
  20. void clsTeste::fcSalvarCadastroEmpresaDBXml(QString &pstrCadEmpresa, stcInfoXml &pstcInfoXmlDados)
  21. {
  22. QString vstrLocal;
  23. stcInfoXml vstcLocal;
  24. vstrLocal = pstrCadEmpresa;
  25. vstcLocal = pstcInfoXmlDados;
  26. }
  27.  
  28. //Arquivo : frmMainWindow.h
  29.  
  30. #include <clsteste.h>
  31. Public:
  32. typedef struct stcInfo
  33. {
  34. QString vstrNome = "Oiaaaa";
  35. }stcInfoDados;
  36.  
  37. Private:
  38. void fcMontarDadosXml();
  39.  
  40. //Arquivo : frmMainWindow.cpp
  41.  
  42. #include "frmMainWindow.h"
  43. QString vpTeste = "Oiaaa";
  44. clsTeste *vobjTesteDBXml = new clsTeste();
  45. vobjTesteDBXml->fcSalvarCadastroEmpresaDBXml(vpTeste, stcInfoDados);
To copy to clipboard, switch view to plain text mode 

Qt Code:
  1. usr/include/libdrm -I. -I../../5.10.1/gcc_64/mkspecs/linux-g++ -o frmMainWindow.o ../RWCXML/frmMainWindow.cpp
  2. //../RWCXML/frmMainWindow.cpp: In member function ‘void clsMainWindow::fcMontarDadosXml()’:
  3. //../RWCXML/frmMainWindow.cpp:390:75: error: expected primary-expression before ‘)’ token
  4. // vobjTesteDBXml->fcSalvarCadastroEmpresaDBXml(vpTeste, stcInfoDados);
  5. ^
  6. Makefile:1363: recipe for target 'frmMainWindow.o' failed
  7. make: *** [frmMainWindow.o] Error 1
  8. 10:57:58: The process "/usr/bin/make" exited with code 2.
  9. Error while building/deploying project RWCXML (kit: Desktop Qt 5.10.1 GCC 64bit)
  10. When executing step "Make"
To copy to clipboard, switch view to plain text mode 

Can anybody help me ?

Thanks in advance...