Eclipse IDE for C/C++, gcc can't find *.c document - c

I am working on a C project in Eclipse, the environment is windows X64,
When I tried to compile the program, it said:
11:54:29 **** Incremental Build of configuration Debug for project
TPCembarque **** Info: Internal Builder is used for build gcc
"-ID:\java workspace\TPCembarque\inc" "-ID:\java
workspace\TPCembarque\lib\" "-includeD:\java
workspace\TPCembarque\lib\libVirtualBoard.a" -O0 -g3 -Wall -c
-fmessage-length=0 -o "src\main.o" "..\src\main.c" gcc: error: workspace\TPCembarque\lib\libVirtualBoard.a -O0 -g3 -Wall -c
-fmessage-length=0 -o src\main.o ..\src\main.c : No such file or directory gcc: fatal error: no input files compilation terminated.
11:54:29 Build Finished (took 657ms)
so as a result it couldn't find main.c
All my data related to the project were saved in D:/systnum
and I created my project in D:/java workspace/TPCembarque.
I've already set the build environment as d:\systnum\MinGW\bin;d:\systnum\MSys\1.0\bin
I have already added the file main.c to the project 1
Could anybody tell me how to let the Compiler find main.c? thanks!

Is it possible to paste the makefile of your project?
I see a potential issue due to two different paths mentioned in your build log.
"src\main.o" -> src is a folder in current directory
"..\src\main.c" -> src is a folder in the directory one folder back.

Related

GCC: No such file or directory

I made a fresh project and have been stuck in this specific issue for hours. I am using a shell script (.bat) file to compile and build the project. If I use no libraries, it compiles and runs fine. However, when I try to add SDL2 I get the issues described in the title. I was using Visual Studio Code, set up everything correctly in tasks.json and the issue persisted. I moved to 4code and the issue remains.
This is my build.bat
#echo off
if not exist build mkdir build
pushd build
gcc ..\source\main.c -o main.exe
gcc -L ..\external\SDL2\include
popd
I added the library in the "external" folder. It tells me it can't find the SDL.h file. I am confused because the file is in ..\external\SDL2\include
I never coded in C, so all this compiler business is new to me. I've searched the web for hours and can't find a solution. I'd appreciate any help.
Directory-adding options must be used with compilation command.
gcc ..\source\main.c -o main.exe is a compilation command without directory adding
and gcc -lSDL2 and gcc -L ..\external\SDL2\include are not compilation commands
because they don't include what to compile.
The 3 gcc invokations should be one invokation:
gcc -L ..\external\SDL2\include ..\source\main.c -o main.exe -lSDL2

gcc: error: CreateProcess: No such file or directory

I am using Kepller eclipse and I have C++ and C projects on that. I have no problem in compiling and running C++ projects, but when I create a C project, I see this error.
gcc: error: CreateProcess: No such file or directory
the whole message is:
23:46:32 **** Rebuild of configuration Debug for project HelloWorld ****
Info: Internal Builder is used for build
gcc "-IC:\\MinGW\\include" -O0 -g3 -Wall -c -fmessage-length=0 -o "src\\HelloWorld.o" "..\\src\\HelloWorld.c"
gcc: error: CreateProcess: No such file or directory
23:46:32 Build Finished (took 416ms)
I have set the path variable as C:\MinGW\bin
is there anybody who can help me.

Gaining sqlite3 functionality in C (Eclipse)

I would like to be able to use the sqlite3 functionality with C, I recently downloaded the sqlite3 amalgamation from the SQLite website and compiled this to get sqlite3.so and hence included this in my project. I have included what I believe to be the necessary libraries to compile the code however I always get the same error. The linker appears to be looking in the wrong folder for -lsqlite3 and I cant find this specified path anywhere in any of the project properties and it also does not appear to be a valid location on my PC!
Below is the output when I try to compile the code. If I am stupidly missing anything required for any help please let me know, bit of a beginner when using eclipse for C.
16:21:03 **** Build of configuration Debug for project SQLite ****
make all
Building file: ../main.c
Invoking: Cross GCC Compiler
arm-linux-gnueabihf-gcc -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"main.d" -MT"main.d" -o "main.o" "../main.c"
Finished building: ../main.c
Building target: SQLite
Invoking: Cross GCC Linker
arm-linux-gnueabihf-gcc -L/root/workspacecpp/SQLite/ -o "SQLite" ./main.o -lsqlite3.so
/home/development/raspberrypi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/../lib/gcc/arm-linux-gnueabihf/4.8.3/../../../../arm-linux-gnueabihf/bin/ld: cannot find -lsqlite3.so
collect2: error: ld returned 1 exit status
make: *** [SQLite] Error 1
You are cross-compiling, so you need to place the ARM[*] version of libsqlite3.so in a place where the cross compiler will look for it. This is likely somewhere in or below /home/development/raspberrypi/tools/arm-bcm2708/. See your cross-compiler's documentation.
[*] Of course you used your cross-compiler to create an ARM version of libsqlite3.so :-)

Building shared libraries with eclipse CDT

I am trying to build a dynamic library but i'm getting this error , can anyone tell me what this means ?
16:42:59 **** Incremental Build of configuration Debug for project 5exe ****
Info: Internal Builder is used for build
gcc "-IC:\\Users\\Dylan Galea\\workspace\\5\\Debug\\" -O0 -g3 -Wall -c -fmessage-length=0 -o 5exe.o "..\\5exe.c"
gcc: fatal error: no input files
compilation terminated.
16:42:59 Build Finished (took 120ms)

Using Eclipse with a pre-existing C Makefile

I wrote a makefile which works fine in shell (ubuntu), but I can't manage to run it from eclipse.
I created a makefile in eclipse, which is seen under DEBUG directory of the relevent project.
In Run/Debug settings I defined in Main tab in C Application: Debug/projectname, and in Project: projectname, Build configuration:Debug. (which now I see it gives me an error of not executable file so I change it to the main.o file).
in C/C++ Build , in Builder Settings I checked use default build command and unchecked Generate Makefiles Automatically. Build directory is ${workspace_loc:/projectname}
What should I do now? How make command can be run?
What is make target? I tried to create one and then build it, but I don't see how it connects to my makefile. Should make target be done from view target of from right click on the project?
From make target view I created new target and when I do 'build target' I get
make mat
make: *** No rule to make target `main.c', needed by `main.o'. Stop.
So it seems to read the right makefile, but what is "No rule to make target `main.c' "? the makefile is:
mat:main.o mat.o
gcc -ansi -lm -Wall mat.o main.o -o mat
main.o:main.c mat.h def.h
gcc -ansi -pedantic -Wall -c main.c
mat.o:mat.c def.h
gcc -ansi -pedantic -Wall -c mat.c

Resources