Projekt w Cpp, kod w c, nie działa.

0

Witam.

Mam następujący problem: muszę użyć bibliotek OpenCV(.cpp) oraz VLFeat(.c) której nie mogę uruchomić wraz z programem używającym OpenCV. VLFeat kompilowany w pliku z rozszerzeniem .cpp generuje następujące errory

 main.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) struct _VlState _vl_state" (__imp_?_vl_state@@3U_VlState@@A)
1>D:\PROGRAMOWANIE\OpenCV\xxxx.exe : fatal error LNK1120: 1 unresolved externals 

Oto przykładowy kod.

 
#include "vl/generic.h"
int main()
{
	VL_PRINT("Hello world\n");
	return 0;
}

Użycie extern "c" nie pomogło.

Czy ktoś zna rozwiązanie takiego problemu?

0

Czy na pewno stosujesz się do instrukcji autorów? Dla przypomnienia:

http://www.vlfeat.org/gcc.html napisał(a)

These instructions show how to setup a basic C++ project which uses the VLFeat library and the g++ compiler. Our project will consist of the following simple file, which we will refer to as main.cpp:
extern "C" {
#include <vl/generic.h>
}

int main (int argc, const char * argv[]) {
VL_PRINT ("Hello world!") ;
return 0;
}

Notice that the extern "C" is required for C++ projects. Compiling the project is straightforward. From the command prompt type:
[vlfeat-user]$ g++ main.cpp -o vlfeat-test -IVLROOT -LVLROOT/bin/a64/ -lvl

In this example, replace VLROOT with the path to your VLFeat installation and replace a64 with your architecture (a64 for 64 bit linux, glx for 32 bit linux).

0

Dzięki. Była to cenna rada. Oczywiście próbowałem również tego kodu, ale wcześniej gdy miałem błędnie utworzony projekt i teraz zupełnie zapomniałem o tym. Jednak świeże spojrzenie na sprawę zmienia dużo;]

1 użytkowników online, w tym zalogowanych: 0, gości: 1