Adding preinclude header file to Eclipse CDT C project - c

I'm importing a C project to Eclipse CDT which has a preinclude header file. I want to know if there's an option to preinclude the file in the projects settings, The projects doesn't compile because of unresolved defines, that needs to be defined in the start.
does anyone encountered this before ?

Yes, I've seen such problems several times.
If your project doesn't compile, you'll have to change the compiler options, since the compiler needs to know about the file. It depends on your compiler, though, since this is not a C feature.

If it is that CDT do not find the files that are "preincluded" by your compiler, then you can fix that by creating build configuration. You do that by clicking on properties/C/C++ Build/Settings/Tool Settings/Cross GCC Compiler/Includes and then add the file you want to be preincluded.

Related

Preprocessor Include Paths, Macros etc. entry not available

I can't navigate through a project in Eclipse (Oxygen.3a Release (4.7.3a) with CDT version 9.4.3.201802261533). The project is built successfully but I can't trace back many functions using ctrl+LMclick.
I tried fixing the problem from online resources, but many suggested modifying the entry of Preprocessor Include Paths, Macros etc, which my project does not even have. What is the reason behind this and how do I fix it?
For some reason, the next entry (C/C++ Include Paths and Symbols) shows that |Include path not found"
When I try to trace a function, I get the "Could not find symbol "xyz" in index". I have already tried rebuilding the indexer but it did not work for me.
In my experience, the absence of the Preprocessor Include Paths, Macros etc. preference page happens in newer versions of CDT when you select the new Makefile Project option in the new project wizard, whose description is
(Experimental) Create a new project that builds with the 'make' build
tool using CDT's new Core Build System.
I would avoid using this as it's experimental, and would select instead C Managed Build (or C++ Managed Build). On the next wizard page you can still make it a makefile project if you want.
I ran into this problem trying to use cmake4eclipse. I forgot to heed the warning in the help file, which explicitly state:
"Do not choose the New C/C++ project wizard, as that will take you down the road of CDT`s new project type (which has poor cmake support)."
What this means is that, for the entry to appear in an executable / library -type project (not Makefile project), you have to do this now:
File --> New --> Other...
Choose "C++ Project" (not "C/C++
Project") under the C/C++ category:
P.S. Also, I had to remake the folder and copy all the sources there, i.e. when I tried the old wizard on top of a "deleted" project, something didn't override correctly and I was still missing "Preprocessor Include Paths, ...". Deleting .cproject and .project files within the folder before recreating works too.
Depending on your project, you may need to include the path of the toolchain manually. It wasn't for me. So for my project I did the following:
Go to Project – Properties – C/C++ Include Paths and add there “C:\Program Files (x86)\GNU Tools ARM Embedded\5.4 2016q3\arm-none-eabi\include” (change to fit your installation). Then refresh, clean and build the project. Finally, rebuild the indexer and this should work.

mantaining compatibility between CLion and eclipse in C project

i have a question that google couldn't solve. thing is i am currently working in a project with around 15 other people. some of us use eclipse and some use clion. the problem is that clion uses a "CMakeLists.txt" file in which specifies all files to be compiled. Eclipse doesn't use this file, but the ones using clion complain that they have to manually add all .c files created in eclipse in that file in order to compile the project. is there a way to get around this? thanks

GTK with C and Eclipse

I have decided to use the GTK library and I have been messing around with it.
My problem does not lie within C or GTK itself, it all about Eclipse. Even though my applications compile and run with no errors, but Eclipse is constantly telling me that there are problems such as:
GTK_DIALOG_MODAL, GTK_MESSAGE_INFO, GTK_BUTTONS_CLOSE... could not be resolved.
Is there a way to make Eclipse understand what is going on?
I guess Eclipse cannot find GTK's header files. You can tell it where to look for them by adding one or more include directories to the project properties:
Project → Properties → C/C++ General → Paths and Symbols → Includes
This works for Eclipse Indigo and Juno, at least.

How to correctly setup a C language project in Eclipse

I'm an experienced Java developer, and I'm very familiar with Eclipse. Lately I've been trying to migrate a Texas Instrumental(BLE), IAR C language project, into Eclipse, without using IAR official Eclipse plugin, I just want to use Eclipse as my code browsing IDE, while I learn how things works, and follow up the tutorial, and in the future use Eclipse to develop.
I've been trying for a day now, to migrate the project, but there is something I'm missing something regarding Eclipse C language support.
There are some types defined in an .h file, in project "A", which is referenced in an other .c file in project "B", and Eclipse although it can "go to declaration", it shows a compilation error in project "B".
I've noticed in other cases of the same scenario, that I don't need to point to any of the folders as source folder, as long as the folders are under the project root directory, they are added to the build path of that specific project, and also imported into a project "B" with only referencing the "A" project in the project properties, is this correct?
Also, I've noticed that in the C language both projects could reference each other, without Eclipse troubling me so I assume this is legit, therefore I assume there should be a C language multi-project structural pattern I should follow, where can I find such detailed specification?
Thanks,
Adam Zehavi.
Try this (Common Source Lookup Path preference)
Edit: in my Eclipse CDT Helios, I do like this:
Right click on project > Properties > C/C++ General > Paths And Symbols.
then choose my language (GNU C) and add the folders with the header files that I want to include.
That operation could be done automatically in one step for every configurations (Run/Debug) or just for the active configuration.
I've finally understood that this cannot be done... alas I've worked hard to been able to edit my code in Eclipse while running, debugging, and deploying the program to the Microprocessor via IAR IDE.
Go to Project > Properties > C/C++ General > Paths and Symbols Then click Export Settings... to save the include paths and/or symbol definitions to a file. In your other project, you can then use Import Settings...

xcode c include files

I would like to use XCode 4 as IDE for my C program.
I am using few libraries, which are not installed in system paths. Also, I am using external program for building (waf).
So, basically, I need XCode for everything, except building.
But I can't figure out how to tell XCode where my library include files are for it to be able to autocomplete functions and everything from that libraries?
In the build settings for the Target - look for the HEADER_SEARCH_PATHS setting.
Have you added the library headers to the project? You can just add them by reference.

Resources