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

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

Related

Compilation of Raylib function fails on Visual Studio Code

I'm getting an error in the compilation of a C file that heavily uses Raylib function.
Environment
OS: Windows 10
IDE: Visual Studio Code
Raylib version: 4.2.0 (win64, mingw)
Sanity check of Raylib installation
Following the discussions in How to add Raylib to VS code?, I successfully compiled an example code: main.c in this link. That means, the Raylib function is correctly installed, and the path to the source libraries is also set correctly.
Compilation of my code
Using the set of JSON files (c_cpp_properties.json, launch.json, settings.json, tasks.json) used in the example code, I'm trying to compile my code. There are several ways to compile code on VS code.
Compilation by F5 key
In this case, I get the following messages on my terminal:
Executing task: C:\MinGW\bin\mingw32-make.exe RAYLIB_PATH=C:/raylib/raylib PROJECT_NAME=MyCode OBJS=MyCode.c BUILD_MODE=DEBUG
mingw32-make: *** No targets specified and no makefile found. Stop.
It seems like I need to make a Makefile to configure the compilation but I have no idea how to write it. I tried using the Makefile in link but it caused an error. I probably need to make a code-specific Makefile but I have no clue.
Compilation by command #1
I also tried to compile my code by running the following command on VS code terminal:
gcc MyCode.c lib/librarylib.a -o MyCode
but I got the following error message:
fatal error: raylib.h: No such file or directory
The header file raylib.h is not recognized even though I used the same header in the example code I compiled earlier. The path to the header is also set properly.
Compilation by command #2
To set the path to the file location of raylib.h more explicitly, I used the following command instead:
gcc -Wall -IC:\raylib\raylib\src MyCode.c MyCode.exe -l/librarylib -o a.out
Note that the C:\raylib\raylib\src is the path to a folder that contains raylib.h. This time I got the following error:
gcc.exe: error: MyCode.c: No such file or directory
gcc.exe: error: MyCode.exe: No such file or directory
Some clues ...
I got this code from another guy. The code was originally developed on M1 mac, and it was compiled successfully by the following command:
clang -framework CoreVideo -framework IOKit -framework Cocoa -framework GLUT -framework OpenGL lib/libraylib.a MyCode.c -o MyCode

Gtk3 - unresolved inclusion

I am using Ubuntu 18.04.4, and Eclipse 2019-12 (4.14.0) and I try to create a little C application with the help of Glade for the user interface.
Adding the following header files in C results in "unresolved inclusion" error:
#include <gtk/gtk.h>
#include <gtk/gtkx.h>
I have searched and tried in many ways to fix this, but unfortunately I didn't manage (I am new to linux/eclipse). The most easy solution seems to be a package called "Pkg-config" that knows itself how to add the gtk package, but unfortunately, this version of Eclipse does not support it.
The compiler sends the following error:
10:22:19 **** Incremental Build of configuration Debug for project MyTestProject ****
make all
Building file: ../src/MyTestProject.c
Invoking: GCC C Compiler
gcc -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/MyTestProject.d" -MT"src/MyTestProject.o" -o "src/MyTestProject.o" "../src/MyTestProject.c"
../src/MyTestProject.c:17:10: fatal error: gtk/gtk.h: No such file or directory
#include <gtk/gtk.h>
^~~~~~~~~~~
compilation terminated.
src/subdir.mk:18: recipe for target 'src/MyTestProject.o' failed
make: *** [src/MyTestProject.o] Error 1
"make all" terminated with exit code 2. Build might be incomplete.
10:22:19 Build Failed. 3 errors, 0 warnings. (took 466ms)
Any ideas how I can solve this? I mention that libgtk-3-dev is installed on my system and it appears inside the "includes" folder.

CMake compilation failing on MSYS2

I'm trying to set up CMake for a project I'm working on, and I'm first trying to compile a simple Hello World program in C. I'm using Windows 10 with MSYS2. If I invoke the compiler (GCC) directly in Bash, it compiles fine without warnings or errors and gives an executable as output which prints "Hello, world!" exactly as expected. My problem comes in when I try to use CMake to compile my project. When I run cmake -G Ninja .. to compile my project, it throws this error:
CMake Error at C:/msys64/mingw64/share/cmake-3.15/Modules/CMakeTestCCompiler.cmake:60 (message):
The C compiler
"C:/msys64/mingw64/bin/cc.exe"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: C:/Users/dylanweber/Documents/C-Projects/webapp/build/CMakeFiles/CMakeTmp
Run Build Command(s):C:/msys64/usr/bin/ninja.exe cmTC_45340 && [1/2] Building C object CMakeFiles/cmTC_45340.dir/testCCompiler.c.obj
FAILED: CMakeFiles/cmTC_45340.dir/testCCompiler.c.obj
C:\msys64\mingw64\bin\cc.exe -o CMakeFiles/cmTC_45340.dir/testCCompiler.c.obj -c testCCompiler.c
/bin/sh: C:msys64mingw64bincc.exe: command not found
ninja: build stopped: subcommand failed.
Notice how it mentions C:msys64mingw64bingcc.exe... there must be some kind of path delineation problem but I've tried setting the CC environmental variable to C:\\msys64\\mingw64\\bin\\gcc.exe and C:/msys64/mingw64/bin/gcc.exe. I have been clearing the CMake caches between runs.
Here is my CMakeLists.txt file:
cmake_minimum_required(VERSION 3.15)
project(webapp)
set(CMAKE_BINARY_DIR ${CMAKE_SOURCE_DIR}/build)
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR})
set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR})
file(GLOB SOURCES "main/*.c")
add_executable(webapp ${SOURCES})
My code is in a "main" folder which is currently just one "main.c" file, in addition to a build directory used to keep all the temporary files in. The most frustrating part is that CMake was just working an hour ago, and I didn't change anything. What can I do to fix this problem?
The solution was not only installing the MinGW64 version of CMake, but also the MinGW64 version of Ninja as well. Since they have different pathing schemes compared to MSYS, they didn't play well together until they were both on the same POSIX-like platform.

Configuring C/C++ on eclipse on Fedora

I installed Eclipse in fedora and then installed the CDT plugin for developping C/C++ applications . All the installation are done !
So now i can create a C/C++ project but when it comes to running it i got this message
launch failed , Binary not found
and
unable to find full path to gcc.
gcc -O2 -g -Wall -c -fmessage-length=0 -o Rad1.o ../Rad1.c
Internal Builder: Cannot run program "gcc": Unknown reason
Error: Program "gcc" is not found in PATH
Is there any more configuration i must do so C/C++ runs?
Thanks.
Executing c/c++ program with eclipse+unix base plate-forme, it requied object file of the program to execute/run it. So first of all you need to build your program by just pressing Ctr+b to buid it. This will create an object file that was required. Now you enabled to run/execute your programe. Good luck :)

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

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;
}

Resources