- 19/01/2014 at 15:48 #249Oskar SegersvärdParticipant
Trying to compile the sample C-code given with gcc (x86_64-w64-mingw32) on Windows 8 results in strange errors.
> gcc .\samples\MinimalGazeDataStream\MinimalGazeDataStream.c -o min.exe -lTobii.EyeX.Client -Llib\x64 gcc.exe: error: .EyeX.Client: No such file or directory
Renaming Tobii.EyeX.Client.dll to tobii.dll and recompiling results in no errors, but running the program produces no output.
Is it possible to compile the sample with GCC or should it be avoided? Any thoughts?20/01/2014 at 11:50 #260AndersParticipant
since the API is a plain C API, it should be possible to use it from just about any compiler.
I tried to reproduce the error that you described. I could get the sample to build and run using gcc/mingw, but I didn’t get the same error message that you did, so I’m not sure if this solves your problem. Anyway:
I used the version of mingw/gcc from SourceForge: sourceforge.net/projects/mingw/files/.
Working from the Windows command line, I ran the same command as you did, but with an additional “-Iinclude” to point out the include path (this must have been a typo). There were errors:
C:\...>gcc .\samples\MinimalGazeDataStream\MinimalGazeDataStream.c -Iinclude -lTobii.EyeX.Client -Llib\x64 -o min.exe C:\...\cckdo7P5.o:MinimalGazeDataStream.c:(.text+0x23): undefined reference to ' _imp__txFormatObjectAsText' [several similar errors] c:/.../ld.exe: C:\...\cckdo7P5.o: bad reloc address 0x0 in section '.data' c:/.../ld.exe: final link failed: Invalid operation collect2.exe: error: ld returned 1 exit status
It seemed that the linker couldn’t find the EyeX API functions. I messed around with the import declaration settings for a while, but then I realized that the linker might be looking for 32-bit symbols and not 64-bit symbols. So I changed the library path. That worked much better. Now I had only a single undefined reference left:
C:\...>gcc .\samples\MinimalGazeDataStream\MinimalGazeDataStream.c -Iinclude -lTobii.EyeX.Client -Llib\x86 -o min.exe C:\...\ccYKt0oq.o:MinimalGazeDataStream.c:(.text+0x3cb): undefined reference to '_gettch' collect2.exe: error: ld returned 1 exit status
The _gettch() function is Microsoft’s character set-neutral equivalent of getch(). No need for that in this sample. So we need a few edits in MinimalGazeDataStream.c: remove the tchar.h #include, change the signature of the _tmain function to a plain main, and replace _gettch with getch.
With those changes applied I could get the sample to compile, link, and run. That is, to get it to run properly you’ll also have to copy the dll file to the same directory as the exe file. But that’s standard procedure.
But like I said, I’m not sure if this solves your actual problem. If I understand your question correctly you were using a different build of the mingw/gcc compiler and it also seems that you were using a different shell. Perhaps escaping the dots in Tobii.EyeX.Client could help?
- You must be logged in to reply to this topic.