Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Compiling Open Source Projects
Index -> Programming, C -> C Help
Goto page 1, 2  Next
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
mirhagk




PostPosted: Fri Nov 12, 2010 11:53 pm   Post subject: Compiling Open Source Projects

I have never really used C before, I've used C++ and C# and everything, but it's always been with the clean microsoft way of handling things, rather than open source, cross platform ways. Now I found an open source project I really want to check out, and utilize possibly. I have no idea how to compile it however. Attached is a copy of the source code downloaded from the site. It has four folders:
examples-includes glview.c (im assuming main code), and a cmakelist.txt
include- includes libfreenect.h (the header file for the libraries, im assuming)
lib- includes cameras.c and cameras.h (the library code im assuming) cmakelists.txt, geninits.py, inits.txt
Modules- FindUSB.cmake, LibFindMacros.cmake (external libraries it depends on maybe??)
and then it also has a cmakelist.txt, the readme.txt and .gitignore

My question is.... What do I do? I've tried just creating a project with these files but i dont think im doing it right, i think its trying to get a library from the FindUSB.cmake... I dunno.
Just so you all know I'm doing this on windows, and I would prefer doing it the clean way with projects and an IDE rather than notepad and command prompt, however I can do that if I absolutely have to.

Any help at all you could input would be amazing. (btw the project is an interface for the Xbox 360's Kinect to run on PC)

:edit I'm using Visual C++ 2008, that shouldn't be a problem right?



libfreenect-938a2d5.tar.gz
 Description:
the open source project for Kinect on PC

Download
 Filename:  libfreenect-938a2d5.tar.gz
 Filesize:  8.82 KB
 Downloaded:  213 Time(s)

Sponsor
Sponsor
Sponsor
sponsor
TheGuardian001




PostPosted: Sat Nov 13, 2010 12:19 am   Post subject: Re: Compiling Open Source Projects

From the looks of it, they used CMake so you can use whatever toolchain you want.

Download CMake, run it in the project directory, and select your toolchain (In your case Visual C++.) CMake will generate the relevant project files so you should be able to build normally.
mirhagk




PostPosted: Sat Nov 13, 2010 12:48 am   Post subject: RE:Compiling Open Source Projects

thank you I got cmake, got it working with C++ visual 2008, but now I get the following error:

USB_INCLUDE_DIR=USB_INCLUDE_DIR-NOTFOUND
USB_LIBRARY=USB_LIBRARY-NOTFOUND
CMake Error at Modules/LibFindMacros.cmake:74 (message):
Required library USB NOT FOUND.

Install the library (dev version) and try again. If the library is already
installed, use ccmake to set the missing variables manually.
Call Stack (most recent call first):
Modules/FindUSB.cmake:31 (libfind_process)
lib/CMakeLists.txt:5 (find_package)

So I'm obviously missing a library or something, my only question is how do I get it and where do I put it once I get it so that it can work.
TheGuardian001




PostPosted: Sat Nov 13, 2010 1:03 am   Post subject: Re: Compiling Open Source Projects

I'd assume it's talking about Libusb
mirhagk




PostPosted: Sat Nov 13, 2010 9:15 am   Post subject: RE:Compiling Open Source Projects

I'm sorry guys, I've tried and tried and I just can't get it working. Can someone please just get this all set up as a visual studio C++ 2008 project?

I would seriously love you for the rest of my life.
Insectoid




PostPosted: Sat Nov 13, 2010 10:16 am   Post subject: RE:Compiling Open Source Projects

I'll be honest, this driver is worthless. All it does is control the motor in the neck of the peripheral and maybe read the camera. It will not magically make your computer a touch-free device. It isn't really worth taking the time to compile, unless you just want to learn about compiling C projects.
mirhagk




PostPosted: Sat Nov 13, 2010 3:39 pm   Post subject: RE:Compiling Open Source Projects

Yeah i know it won't, however I really want to fool around with controling the motor and it apparently recieves both RGB and depth data so I could theoritically reconstruct the same sort of thing (most likely not, but I want to fool arouind with it anyways)
TheGuardian001




PostPosted: Sat Nov 13, 2010 6:41 pm   Post subject: Re: Compiling Open Source Projects

it does indeed send back both Depth and RGB data (It does lack the body-detecting software that makes it useful.)
Posted Image, might have been reduced in size. Click Image to view fullscreen.
Left is an output of depth data, right is (obviously) the RGB data.

Edit:And no, I can't generate your VC project files for you. Those things are a mess, and almost certainly will not survive the transition from one computer to another. What exactly isn't working? I managed to generate VC++ project files without trouble.
Sponsor
Sponsor
Sponsor
sponsor
mirhagk




PostPosted: Sat Nov 13, 2010 10:28 pm   Post subject: RE:Compiling Open Source Projects

well I couldn't get it to work with my libusb, so I had to manually create my own project, and it's failing on a wierd line

In depth_process (in camera.c) the following lines generate errors

struct frame_hdr *hdr = (void*)buf;
uint8_t *data = buf + sizeof(*hdr);
int datalen = len - sizeof(*hdr);

It says "syntax error missing";" before type" at the first line, "uint8_t illegal use of this type as an expresiion" on the second

(and also another error on the typedef of uint8_t) along with like 30 others

Edit: And I transfer projects all the time, as long as you include all of the files into a folder rather than linked all over the place it seems to work fine. Could you let me know of any code edits you did.
TheGuardian001




PostPosted: Sat Nov 13, 2010 11:01 pm   Post subject: Re: Compiling Open Source Projects

I'm assuming this is with Libusb?
There's a pre-compiled win32 version over here

After you've downloaded and extracted that (specifically the lib file in "msvc" and the include file, usb.h), run CMake, and pick your compiler (don't use the x64 version though, it seems broken.) You should get two errors, both relating to libusb. Click to the far right of each error, and you'll be able to set the path for both the libusb include and library files. Reconfigure, click generate, and you'll have a working MSVC project.

Edit: It's worth noting that there is no guarantee this will actually compile. CMake will generate everything the compiler needs to build the project, but Microsoft has been known to ignore standards/implement nonstandard behaviour in their toolchain, so it's very possible to encounter errors simply by using MSVC if this project happens to encounter one of these situations.
mirhagk




PostPosted: Sun Nov 14, 2010 12:18 am   Post subject: RE:Compiling Open Source Projects

i think im running into one of those errors, everything is linked up (manually done, created project), but the code won''t compile

edit: what did you use to compile the progam? I downloaded codeblocks, but im still having difficulties.

EDIT2: Figured out something that caused my visual studio program to fail to compile. When compiling C code, it is strict to standard C, which means all variable must be declared at the top of their scope. However it doesn't tell you that that is the problem, but bing told me!

Edit3: Down to 3 errors now (one of them is an include of a library, I can easily fix that) The other two are more troublesome.

1>c:\users\nathan\lotro\attempt at compiling\cameras.c(282) : error C2440: 'function' : cannot convert from 'void (__cdecl *)(libusb_transfer *)' to 'libusb_transfer_cb_fn'
1>c:\users\nathan\lotro\attempt at compiling\cameras.c(282) : warning C4024: 'libusb_fill_iso_transfer' : different types for formal and actual parameter 7
1>c:\users\nathan\lotro\attempt at compiling\cameras.c(283) : error C2440: 'function' : cannot convert from 'void (__cdecl *)(libusb_transfer *)' to 'libusb_transfer_cb_fn'
1>c:\users\nathan\lotro\attempt at compiling\cameras.c(283) : warning C4024: 'libusb_fill_iso_transfer' : different types for formal and actual parameter 7

I have no idea what these even mean (well I get that it says the parameters aren't valid). Does anyone know how to fix it?
mirhagk




PostPosted: Mon Nov 15, 2010 1:40 pm   Post subject: RE:Compiling Open Source Projects

Sorry, I fixed the above problems (simply cast them to the required type) Now the only problems left were in the program utilizing the library, so I scrapped that and started my own. No more compiler errors, but now I have these linker errors

1>cameras.obj : error LNK2019: unresolved external symbol _libusb_control_transfer@32 referenced in function _send_init
1>cameras.obj : error LNK2019: unresolved external symbol _libusb_submit_transfer@4 referenced in function _cams_init
1>cameras.obj : error LNK2019: unresolved external symbol _libusb_alloc_transfer@4 referenced in function _cams_init
1>C:\Users\nathan\lotro\oldnect\libfreenect-4094151\OldNect\Debug\OldNect.exe : fatal error LNK1120: 3 unresolved externals


I really don't know how to fix them, can someone please help me?
TheGuardian001




PostPosted: Mon Nov 15, 2010 4:01 pm   Post subject: Re: Compiling Open Source Projects

are you linking against libusb?
mirhagk




PostPosted: Mon Nov 15, 2010 9:50 pm   Post subject: RE:Compiling Open Source Projects

I'm pretty sure I am, I don't even know, everything is kinda compilcated. What do I have to do to link it?
TheGuardian001




PostPosted: Mon Nov 15, 2010 10:17 pm   Post subject: Re: Compiling Open Source Projects

In the project properties window, select the "Linker" category, then choose "input" and add the library name to the list.
But for some reason the "Linker" category is not always available, and I see now indication as to why it isn't (it isn't there for the "libfreenect" project for me, but shows up for the "glview" project.)

Well here's another nice reason to like GCC. Linking with libusb is as simple as typing -lusb.
Display posts from previous:   
   Index -> Programming, C -> C Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 2  [ 17 Posts ]
Goto page 1, 2  Next
Jump to:   


Style:  
Search: