Pagina 1 di 2 1 2 ultimoultimo
Visualizzazione dei risultati da 1 a 10 su 11
  1. #1

    [VC++ express 2008]Problemi con il linker, includere e usare librerie in un form

    Salve a tutti, ho un un enorme problema. Sto tentando di includere nella mia applicazione di tipo CLR Form una libreria esterna. Quest'ultima è provvista di istruzioni ufficiale che riporto qui sotto:
    For Microsoft Visual C++ applications, you need to include the header file include\C\LuxandFaceSDK.h, and the stub library file facesdk.lib into your project. Copyright c 2005¡V2011 Luxand, Inc. http://www.luxand.com 11 Follow these steps to add the library to your project: „h Copy include\C\LuxandFaceSDK.h into the directory of your project „h For 32-bit applications, copy bin\win32\facesdk.dll and bin\win32\facesdk.lib into the output directory of your project „h For 64-bit applications, copy bin\win64\facesdk.dll and bin\win64\facesdk.lib into the output directory of your project „h Choose Project Properties ¡V Linker ¡V Input ¡V Additional Dependencies, and add facesdk.lib string „h Choose Project Properties ¡V Linker ¡V General ¡V Additional Library Directories Dependencies, and add $(OutDir) string (a reference to the output directory) „h Add the following statement to the beginning of your application: include "LuxandFaceSDK.h" The output directory $(OutDir) typically refers to Debug\ or Release\ in the directory of your solution. You may change it in the Configuration Properties ¡V General of your project. You may also choose another directory to store the .lib file, but it is recommended to keep facesdk.dll in the directory where the executable file of your application is located. You need to redistribute the file facesdk.dll with your application.
    Quindi faccio:
    -Nuovo progetto -> CLR Windows Form
    -Copio i 3 file richiesti nella cartella del progetto.
    -Eseguo le operazioni descritte nelle istruzioni.
    -Ora non ho ben capito dove fare #include "LuxandFaceSDK.h"... Nella pagina Form.h, Nella pagina .cpp principale del progetto o dove? Ho provato in entrambi i modi ma quando uso una qualsiasi funzione della libreria, a prescindere dove la uso, il compilatore mi da il seguente errore:
    codice:
    1>Compilazione in corso... 1>en test.cpp 1>Collegamento in corso... 1>en test.obj : error LNK2028: al token non risolto (0A000015) "extern "C" int __cdecl FSDK_ActivateLibrary(char *)" (?FSDK_ActivateLibrary@@$$J0YAHPAD@Z) si fa riferimento nella funzione "int __clrcall main(cli::array<class System::String ^ >^)" (?main@@$$HYMHP$01AP$AAVString@System@@@Z) 1>en test.obj : error LNK2019: riferimento al simbolo esterno "extern "C" int __cdecl FSDK_ActivateLibrary(char *)" (?FSDK_ActivateLibrary@@$$J0YAHPAD@Z) non risolto nella funzione "int __clrcall main(cli::array<class System::String ^ >^)" (?main@@$$HYMHP$01AP$AAVString@System@@@Z) 1>C:\Users\Simone\Desktop\ennesimo test\en test\Debug\en test.exe : fatal error LNK1120: 2 esterni non risolti
    A questo punto io non so più dove mettere le mani, sono disperato, se potreste darmi una mano ve ne sare molto grato!

  2. #2
    Utente di HTML.it L'avatar di oregon
    Registrato dal
    Jul 2005
    residenza
    Roma
    Messaggi
    36,465
    Ma questa libreria è fatta per .NET o è per applicazioni native 32/64 bit ?
    No MP tecnici (non rispondo nemmeno!), usa il forum.

  3. #3
    E' anche .NET, infatti ci sono anche istruzioni e librerie per usarla in .NET.
    p.s.: Io ho w7 64 bit.

  4. #4
    Utente di HTML.it L'avatar di oregon
    Registrato dal
    Jul 2005
    residenza
    Roma
    Messaggi
    36,465
    Da quello che ho velocemente letto sulla documentazione, la libreria è scritta in C ed esiste un

    wrapper .NET

    che devi utilizzare.

    Sembra che esistono anche degli esempi di utilizzo in C# ... li trovi ?
    No MP tecnici (non rispondo nemmeno!), usa il forum.

  5. #5
    Esiste una dll che si chiama FaceSDK.NET.dll ma è richiesta solo per C# e VB, quindi il vc++ non la richiede (almeno in teoria).
    Posto le istruzioni per usare il tutto in c# e vb, ma è piuttosto lunga:
    Using with .NET (C# and VB) For Microsoft .NET applications, you need to add the .NET component into your project. Follow these steps to add the component in Visual Studio 2005/2008:
    Select Project – Add Reference – Browse
    For 32-bit applications, choose the file bin\win32\FaceSDK.NET.dll
    For 64-bit native applications, choose the file bin\win64\FaceSDK.NET.dll
    Add the following statement to the beginning of your application: using Luxand After that you may use the methods of the Luxand.FSDK namespace for general FaceSDK functions, and Luxand.FSDKCam namespace for webcam-related functions. You may refer just to FSDK and FSDKCam namespaces if using Luxand is specified. Once FaceSDK.NET.dll is added to the references, it will be redistributed automatically with your application, so no specific deployment actions are required. You do not need to redistribute facesdk.dll with your application. However, you need to redistribute Microsoft Visual C++ 2008 SP1 Runtime. By default, the documentation refers to C/C++ declarations of FaceSDK functions. For example, the function to detect a face is referred to as FSDK_DetectFace function. To refer to this function in .NET, replace the FSDK_ prefix with FSDK. namespace. Thus, the reference to this function becomes FSDK.DetectFace (note that webcam-specific functions are located in the FSDKCam. namespace; refer to Working with Web Cameras for details).

  6. #6
    Ho provato a seguire il tuo consiglio includendo la dll per .NET e usando quindi
    codice:
    Luxand::FSDK::ActivateLibrary("chiave");
    E incredibilmente compila! Subito dopo però mi da il seguente errore:
    Eccezione non gestita di tipo 'System.BadImageFormatException' in Modulo sconosciuto. Informazioni aggiuntive: Impossibile caricare il file o l'assembly 'FaceSDK.NET, Version=4.0.0.0, Culture=neutral, PublicKeyToken=null' o una delle relative dipendenze. Tentativo di caricare un programma con un formato non corretto.

    Suggerimenti?

  7. #7
    Utente di HTML.it L'avatar di oregon
    Registrato dal
    Jul 2005
    residenza
    Roma
    Messaggi
    36,465
    Originariamente inviato da nostradamus1915
    Esiste una dll che si chiama FaceSDK.NET.dll ma è richiesta solo per C# e VB, quindi il vc++ non la richiede (almeno in teoria).
    Perché dici questo? Tu utilizzi C++.NET quindi devi utilizzare quella DLL !

    Per l'errore probabilmente è la mancanza di qualche DLL della libreria C
    No MP tecnici (non rispondo nemmeno!), usa il forum.

  8. #8
    Capito ma non mi funge lo stesso

  9. #9
    Utente di HTML.it L'avatar di oregon
    Registrato dal
    Jul 2005
    residenza
    Roma
    Messaggi
    36,465
    Originariamente inviato da nostradamus1915
    Capito ma non mi funge lo stesso
    Probabilmente l'installazione di tutte le varie librerie non è corretta e non trova una DLL o qualche altro file.

    Hai seguito tutte le istruzioni per il C#?
    No MP tecnici (non rispondo nemmeno!), usa il forum.

  10. #10
    Apparentemente ce l'ho fatta! In pratica ho incluso la libreria e messo using Luxand nel file .cpp principale e ho richiamato le istruzioni nel loader del form.
    Grazie 1k, senza il tuo aiuto non ce l'avrei mai fatta

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.