How to configure eclipse for C? - c

I've installed an eclise for C/C++ developers. But unable to compile the code. It doesn't get #include <stdio.h> saying: unresolved inclusion <stdio.h>. I wonder if I have to make some addtional configuration. My OS is Windows 7 32 bit.
Please advise.

Well if such basic things do not work, then you must have missed to install a proper toolchain. Just downloading Eclipse and CDT will not "do" it. So install some usable compiler, linker etc.

Related

Library <graphics.h> is missing for MinGW-W64

Compiler: MinGW-W64 GCC-8.1.0 (x86_64-posix-seh)
Missing library: graphics.h
It seems like this library was not installed by default. If such case is true, where can I get it?
As a side note, I am not interested in installing a full IDE like Visual Studio just to use this one library.
After looking into this for 5 minutes, I think you will need to install either sdl-bgi or WinBGIm. Since MSYS2 doesn't seem to have packages for these, you would need to compile those projects from source. This means you would need to figure out the correct set of configuration optiosn and possibly fix any build errors. If you do succeed in doing that, you might consider contributing your work as an MSYS2 package so others can benefit from it ( https://github.com/Alexpux/MINGW-packages ).

While Coding in C (MinGW) fatal error: sdkddkver.h: No such file or directory

I have just installed MinGW
This is the code
#include<stdio.h>
int main() {
printf("Hello, world!");
return 0;
}
I am getting this error:
In file included from c:\mingw\include\_mingw.h:73:0,
from c:\mingw\include\stdio.h:56,
from main.c:1: c:\mingw\include\w32api.h:59:23: fatal error: sdkddkver.h: No such file or directory #include <sdkddkver.h>
^ compilation terminated.
This looks like a problem with your mingw install, missing dependencies, or environment. Your C code is 100% correct so it's not really a "C" language question at all.
Typically... the only thing that REQUIRES mingw is compiling pre-existing Linux code for distribution on Windows.
If that's really what you need you could:
Try installing Windows SDK to see if it resolves. The missing header: sdkdkver.h is part of Windows SDK (per a very quick google search).
Uninstall mingw & re-install with different instructions.
I've had decent success with cygwin in the past. Looks like MSYS2 is a viable alternative that's more dedicated to building windows "native" SW.
Could dig through mingw documentation on environment variable setup. Maybe missing something there.
Alternatives if you DON'T need to compile + distribute existing Linux source for Windows:
Target Windows directly. Free versions of Visual Studio support compiling C or C++ code. So if you're writing FOR WINDOWS, this is your best bet.
Could use Windows Subsystem For Linux ... if you're just looking run Linux SW or do Linux SW development on a natively windows machine.

regex.h in dev-c++ (windows )

I am trying to use regex in a c program. i am using windows 10 and Dev-C++ . whenever i add header file for regex i.e.
#include <regex.h>
it gives me error
[error] regex.h: NO such file or directory.
i couldn't figure out how to download and install regex library for c in dev-c++. compiler: TDM-GCC 4.9.2 64-bit Release. Thanks for your help.
I assume there something wrong with the include path during the compilation process. There is a nice expanation of the compilation process of c/c++ applications over here, in case you're interested.
Basically, when compiling a c/c++ application, your compiler, in a first step, scans your source files and replaces all #include <file.h> with the content of file.h it finds in its search path.
Dev-c++ uses MinGW and a port of the GNU compiler collection (gcc) for the compilation process.
Now what you have to do:
Figure out whether regex.h is included in your MinGW installation (Check /usr/include.)
Adapt the include path in dev-c++
Sadly I don't have a computer running Windows nearby making it hard to help with these two steps. To install regex on MinGW this package seems promising.

wascana eclipse simple C code Launch failed no binaries found

I am new to Eclipse CDT. I did some online search but I got lost. I installed MinGW (works fine with command window), then I installed Eclipse Helios wascana. I did add path/enviroment to Properties->C/C++ build -> enviroment (C:\MinGW\bin)
Eclipse underlines
#include <stdlib.h>
#include
#include
unresolved inclusion. I guess I did not link it to MinGW libraries.
Can anyone help?
In my case, I did the following: Properties->C/C++ Build -> Tool Chain Editor then I chose MinGw GCC as the current toolchain. It looks like it works now. Give it a show
Go to:- properties> C/C++ Build> Tool Chain Editor>
then, select :-
Current Tool chain as --> Cygwin GCC
and,
Current builder as --> CDT Internal Builder
it worked for me. hope it will work for u and others as well!! :)
EDit : for linux users
I got this error even when the compiler was certanly ok, so only build/rebuild (sometimes) and starting new project could help. May be it's not your case, but Eclipse "loves" this error so much, that's wat i found out about it

How to run a Simple C Program in Eclipse IDE

I've downloaded Eclipse C/C++ IDE . I need to run a simple c program in this(To print welcome).
While trying to run the program its popping up an error message like "Launch failed: Binary not found" .
Need i install any compiler package. ?
Please help me to do this.
Yes, you have to install a compiler, Eclipse is only an IDE. You can get MinGW here.
http://www.eclipse.org/cdt/
Look at the above link,you will get more idea,on how to do development using C/C++ using eclipse.
You can make use of the documentation which comes along with the IDE.
Just on the start up window in Eclipse click Tutorials and then click on c/c++ development link and then read Before you Begin part.
The program you write must be converted into respective binary which is to be run on that particular architecture.This process is carried out by the compiler as a result compiler is required for eclipse IDE to compile and link the code .
Various compilers are available such as Microsoft Visual C++ MinGW GCC or Cygwin GCC in the form of chaintools in eclipse so as to compile the code.
Eclipse is an IDE.It will help you write applications in c/++,but it will not compile your program as Eclipse does not comes with a compiler pre-configured.
You need to install a compiler to run your application.
Eclipse is capable to use many c/c++ compilers,some are:
1.Cygwin
2.MingW
3.Gross
4.Microsoft Visual C++
I would advise to install mingW OR Cygwin.
If you need more help on running a c/c++ application in Eclipse
visit http://www.ibm.com/developerworks/opensource/library/os-ecc/?S_TACT=105AGX44&S_CMP=ART

Resources