0

I have following function call:

sparseAct =new QAction(QIcon(":Icons/icons/sparse.jpg"),tr("Sparse Reconstruction"),this);

connect(sparseAct, SIGNAL(triggered()),this, SLOT(sparsereconstruction()));

and

void UAVgeoreferencer::sparsereconstruction(){

ShellExecute(NULL, L"open", L"C:\\WINDOWS\\system32\\cmd.exe", L"/C C:\\Images\\sparseRecon64.bat", L"C:\\Images\\", SW_SHOWNORMAL);

}

When I do this I get error like:

uavgeoreferencer.obj:-1: error: LNK2019: unresolved external symbol __imp_ShellExecuteW referenced in function "private: void __cdecl UAVgeoreferencer::sparsereconstruction(void)" (?sparsereconstruction@UAVgeoreferencer@@AEAAXXZ)

Can anyone tell me what is the problem and how can I solve it??

2
  • I think you should link your program against Shell32.lib library too in order to use its ShellExecute function, or you need to use QProcess to execute the sparseRecon64.bat script. Commented Apr 8, 2015 at 10:07
  • Seems like a bit of an XY problem. I'd use QProcess for this. Commented Apr 8, 2015 at 10:07

2 Answers 2

1

You can use QProcess for this purpose since it inherits QObject and QIODevice, you have everything you need to pass data between other Qt objects you might be using but you don't have to. You can always create your own objects that inherit from QObject and then implement signals and slots mechanism but QProcess will make life easier as it has already everything one might possibly need for shell access. However, the problem you are facing is related to the linker and has nothing to do with Signals and Slots mechanism.

Sign up to request clarification or add additional context in comments.

Comments

0

Most likely you have forgotten to link required windows library to your project. Try adding this to your .pro file:

LIBS *= Shell32.lib

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.