Eclipse + OpenCV + Cygwin --> cv.h: No such file or directory - c

Hi I'm having troubles in Eclipse including OpenCV Library. I Follow a lot of tutorials but i can't compile anything. Here is the output from the console.
Building file: ../hand.c
Invoking: Cygwin C Compiler
gcc -O2 -g -Wall -c -fmessage-length=0 -MMD -MP -MF"hand.d" -MT"hand.d" -o"hand.o" "../hand.c"
cygwin warning:
MS-DOS style path detected: D:\Eclipse_workspace_C++\HelloWorld\Default
Preferred POSIX equivalent is: /cygdrive/d/Eclipse_workspace_C++/HelloWorld/Default
CYGWIN environment variable option "nodosfilewarning" turns off this warning.
Consult the user's guide for more details about POSIX paths:
http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
../hand.c:3:16: fatal error: cv.h: No such file or directory
compilation terminated.
subdir.mk:18: recipe for target `hand.o' failed
make: *** [hand.o] Error 1
I'm using OpenCV2.0.
I configured in proyect properties the C/C++ Build -> Settings -> Tool Settings Tab -> Compiler and Linker to add library and headers of opencv but i can not compile it.
ScreenShoot of my eclipse project.

SOLVED!
Steps for configure Eclipse and OpenCV 2.4.5 in Windows
1) after installing Opencv include in environment path your directory where opencv is installed, mine is opencv\opencv2.4.5\build\include
2) I use Cygwin to compile c files. So configure your eclipse using CDT for Cygwin and in project setting put next configuration.
if you are using mingw put there in linker settings. For me it's only vc9.
3)My source file is like
#include <stdio.h>
#include <stdlib.h>
#include <cv.h>
int main(void) {
puts("Hello World!!!");
return EXIT_SUCCESS;
}

Related

Compiling SDL on Windows with Mingw gcc

I downloaded SDL for MinGW here : https://www.libsdl.org/download-2.0.php.
But when I try to compile with gcc it can't find the libraries.
It says it cannot find "SDL2/SDL.h".
I tried running GCC with the parameters to include the path after moving the folder containing
SDL2 to the same directory of the project.
I used this command:
gcc main.c render.c sprite.c logic.c menu.c level.c -o release -l:SDL2\x86_64-w64-mingw32\lib\libSDL2main.a -l:SDL2\x86_64-w64-mingw32\lib\libSDL2.a -ISDL2
If you want the compiler to find the libraries, you need to include the directory it is in using -I/dir/

Unresolved Inclusions in Eclipse-Cygwin- #include <stdio.h>

I have been trying to test a program using cygwin64 (on Windows 10 and Eclipse 20-21) because my target is a Linux Realtime system, I have installed cygwin64 and as per this document (https://www.eclipse.org/4diac/documentation/html/installation/cygwin.html) . I have to add environment in windows
still my inclusion #include<stdio.h>, #include <stdlib.h> etc says unresolved
I checked if Cygwin is installed by going to cmd and giving bash. which returned correctly
My path variables are like this
My toolchain settings are like this
This is my build report
15:52:34 **** Incremental Build of configuration Debug for project udpexx1 ****
Info: Internal Builder is used for build
gcc "-IC:\\cygwin64" -O0 -g3 -Wall -c -fmessage-length=0 -o "src\\udpexx1.o" "..\\src\\udpexx1.c"
Cannot run program "gcc": Launching failed
Error: Program "gcc" not found in PATH
PATH=[C:\cygwin64\bin]
15:52:34 Build Finished. 0 errors, 0 warnings. (took 94ms)
#####################################################################
Is there anything that im missing or need to do?
my run configurations are like this

Linking libraries with a MinGW project in VS code

I am using MinGW version 4.5.2 on windows 10. I am trying to link multiple libraries to a project in VS code. When I try run this command: g++ main.c -o main.exe -I"C:\\Users\\USER\\Programming\\OPenGL Library\\glfw\\include\\glfw3.h" -L"C:\\Users\\USER\\Programming\\OpenGL Library\\glfw\\lib-mingw-w64\\". I get a compile error: main.c:2:24: fatal error: GLFW\glfw3.h: No such file or directory What is wrong with the command above that gives this linking error. As far as I can tell I have pointed MinGW to the library and specified the header file. I am not sure what else I need to add to the command for link the GLFW library as well as other libraries such as GLEW or glm.
If your include directive looks like
#include <GLFW/glfw3.h>
you need to supply a path to a directory which itself contains a directory named GLFW.

Bluetooth programming in Linux - cross compiler issue

I've installed
sudo apt-get install libbluetooth-dev
to have bluetooth package in my environment.
Hence, using the following command can successfully compile the bluetooth code using gcc.
gcc -o bt bt.c -lbluetooth
However, when I tried to use the cross-compiler to compile the source code
$CC -o bt2 bt.c -lbluetooth
I got the fatal error:
fatal error: bluetooth/bluetooth.h: No such file or directory
compilation terminated
Is there anything I've done wrong or I need to link this library to this cross-compiler ?
Thanks
I guess your cross compiler comes with a complete toolchain and SDK.
You must check that e.g. libBluetooth.so installed into your SDK under /usr/lib or /usr/local/lib folders and the correct header, as the one installed for i386/x64 platform, is present into SDK.
In case of the header and lib exist you must change your #include into your code to match the path into your SDK.

Gtk with Eclipse CDT

I installed pkg-config
and added pkg-config -cppflags and pkg-config --libs in build setting
please help
I am working on windows 8 and eclipse kepler
14:58:32 **** Incremental Build of configuration Debug for project Hi_c_gtk ****
make all
Building file: ../src/Hi_c_gtk.c
Invoking: Cross GCC Compiler
gcc -O0 -g3 -Wall -c -fmessage-length=0 pkg-config gtkmm-2.4 --cflags -MMD -MP -MF"src/Hi_c_gtk.d" -MT"src/Hi_c_gtk.d" -o "src/Hi_c_gtk.o" "../src/Hi_c_gtk.c"
cygwin warning:
MS-DOS style path detected: C:\Users\Project\workspace1\Hi_c_gtk\Debug
Preferred POSIX equivalent is: /cygdrive/c/Users/Project/workspace1/Hi_c_gtk/Debug
CYGWIN environment variable option "nodosfilewarning" turns off this warning.
Consult the user's guide for more details about POSIX paths:
http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
gcc: error: pkg-config: No such file or directory
gcc: error: gtkmm-2.4: No such file or directory
gcc: error: unrecognized command line option ‘--cflags’
src/subdir.mk:18: recipe for target 'src/Hi_c_gtk.o' failed
make: *** [src/Hi_c_gtk.o] Error 1
I understand you're trying to integrate GTK with Eclipse on Windows.
I've recently managed to achieve so in both GNU/Linux and Windows environments. On GNU/Linux it was as easy as install pkg-config from the Eclipse marketplace and adding needed libraries.
On Windows tough, I had to configure include paths manually by modifying compiler options. You need to add manually all includes and libraries requested by GTK+ on Project-C/C++ Build-Settings. I used Cygwin's gcc.
The full process is described on http://irkedrants.blogspot.com.es/2011/02/configuring-eclipse-to-compile-gtk.html

Resources