0

私はWindows7x64でc++言語で作業しています。

ShellExecuteEx関数を使用して、Webカメラにマーカーを表示したときにFirefoxブラウザーを開くプロジェクトを作成しました。私のプロジェクトは、VisualStudio2010でうまく機能します。

しかし、Qt Creatorを使用してプロジェクトを実行しようとすると、次のエラーが発生します。

main_cam.obj:-1: error: LNK2019: riferimento al simbolo esterno __imp__ShellExecuteExW@4 non risolto nella funzione _main
debug\cam.exe:-1: error: LNK1120: 1 esterni non risolti

コードは次のとおりです。

#include <iostream>
#include <stdio.h>
#include <string>   // for strings
#include <iomanip>  // for controlling float print precision
#include <sstream> // string to number conversion
#include <windows.h>
#include <ShellAPI.h>
include [...]
int main () {
[...]
SHELLEXECUTEINFO ShExecInfo = {0};
ShExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);
ShExecInfo.fMask = SEE_MASK_NOCLOSEPROCESS;
ShExecInfo.hwnd = NULL;
ShExecInfo.lpVerb = NULL;
ShExecInfo.lpFile = "firefox.exe";
ShExecInfo.lpDirectory = NULL;
ShExecInfo.nShow = SW_SHOW;
ShExecInfo.hInstApp = NULL;
[...]
if (condition_is_verified) {

ShExecInfo.lpParameters = (LPCWSTR)"www.google.it";
ShellExecuteEx(&ShExecInfo);
WaitForSingleObject(ShExecInfo.hProcess,INFINITE);
}
[...]
}//end main 

問題はshell32.libだと思います。もしそうなら、私は私のPCにこのライブラリを持っていません。どうすれば修正できますか?

手伝って頂けますか?

前もって感謝します!

4

2 に答える 2

1

とてもシンプルです。プロジェクトの pro ファイルを右クリックして、外部ライブラリを追加します。システム ライブラリの static を選択し、次の shell32.lib のパスを指定します。

C:\Program Files\Microsoft SDKs\Windows\v7.0A\Lib
于 2013-09-23T09:07:34.157 に答える
1

これは、この問題に対する私の解決策です:

.pro ファイル内: INCLUDEPATH += "C:\Program Files\Microsoft SDKs\Windows\v7.0A\Lib" (ファイル shellAPI.lib へのパス)

私のmainwindow.hで:

#define NOMINMAX // You have to do this for windows.h to work, else u'll get mistakes with datetime.h           
#include <windows.h> // (without the space)    
#pragma comment(lib, "Shell32.lib")    
#include <ShellAPI.h> // without space also
于 2014-05-23T09:29:18.897 に答える