How to make project folder act as system folder in Eclipse Luna - c

I'm working on a porting of the net-snmp library. I started by importing the parts of the code that I need in my Eclipse Luna project, running on Lubuntu Linux 15.10. I don't want to modify every single file from (for instance)
#include <net-snmp/net-snmp-config.h>
to
#include "net-snmp/net-snmp-config.h"
I don't want to install net-snmp in my system either, to avoid confusion.
How do I tell Eclipse to look in the project root for header files?
Thanks

Ok I think I found a way:
go to Project Properties
under C/C++ Build go to Settings
under the tab "Tool Settings" go to "Includes" under "GCC C Compiler"
Click the "+Add" icon under "Include paths (-l)"
Click "Workspace" and then select the folder

Related

How do you configure XCode to find header files and symbols in an "External Build System" project

I'm trying to set up an XCode 5.1 project for C php-extension development. This is essentially a GNU autoconf/automake project with one prerequisite step.
I created a new "External Build System" project. I then made two targets, one that runs the prerequisite "phpize" command that creates GNU autoconf files. I have another target that runs the GNU ./configure script. This all works great.
Next, I tried adding my .c and .h files to the project. When I open them, and try to click on any #include .h file or any external symbol, XCode says "symbol not found", even for system stuff like <stdio.h>.
In a normal XCode project, there is a way to configure the header/include search paths. With this external build system project, I see no way to do this.
My questions:
For a project that uses ./configure and make, is the "External Build System" project type the correct type?
If so, then in this project type, how do I set the header/include search paths so that code navigation works?
Analyze doesn't seem to work right, either.

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 can I link the source path of a compiled library to a different location in Eclipse?

I've installed the msp430-gcc compiler and associated tools to do some open-source msp430 development at home using Eclipse. I'm developing on a slightly older Macbook Pro running OS X Lion and installed the tools using MacPorts. I'm running Eclipse 3.7.2 with the CDT and GCC Cross Compiler Support plug-ins. I have a simple empty main() written that compiles and links just fine.
The ELF parser lets me view the contents of the ELF binary just fine with the exception of one component; when I try to view the contents of the startup code in crt0.S, it gives me a blank file. When I click on the crt0.S component of the ELF, the filename bar at the bottom of the Eclipse window shows "/opt/local/var/macports/build/_Volumes_work_mports_dports_cross_msp430-gcc/msp430-gcc/work/gcc-4.6.3/gcc/config/msp430/crt0.S". This makes sense because of my MacPorts install of msp430-gcc. crt0.S is archived into /opt/local/lib/gcc/msp430/4.6.3/libcrt0.a on my machine.
What I want to be able to do is tell Eclipse to look elsewhere for the source files for the libraries that are automatically linked when I build with the msp430-gcc toolchain. This would presumably include everything in /opt/local/lib/gcc/msp430/4.6.3/. I started by downloading the source for mspgcc-20120406 (the version in my MacPorts install) and applying the gcc patchfile to an empty directory tree. This created the gcc/config/msp430 directory, including the crt0.S and crt0ivtbl.S files.
What I have had no luck accomplishing is telling Eclipse to look in ~/Developer/mspgcc-20120406/gcc-4.6.3/config/msp430/ instead of the path that's in the already-built libcrt0.a. I tried playing around with the Project Preferences->Paths and Symbols->Source Location window, but didn't have much luck. I searched through this website and on Google and the closest thing I came up with was this question but it doesn't "smell" like the right answer.
I would like to avoid solutions that involve moving the library source into my project. I'd rather have a solution that will work for multiple projects.
All help is greatly appreciated! Thanks in advance.
Try and check if the Eclipse linked resource could help you declare that external directory from within your Eclipse project here.
Linked resources are files and folders that are stored in locations in the file system outside of the project's location. These special resources can be used to add files and folders to your project that for some reason must be stored in a certain place outside of your project. For example, a linked folder can be used to store build output separately from your source files.
I find interesting how you can define that linked resource:
Linked resource target paths can be either defined as absolute paths, or relative to a path variable.
Since you can define it relative to (for instance) your Eclipse project location PROJECT_LOC, you can then setup your resource in a way which won't change between two environments.

ntddk.h no such file or directory

I am using CODE::BLOCKS in windows XP. Tried to write a device driver. But right after creating a project, I got below error. I did below settings, but still getting the error as
"ntddk.h no such file or directory". I have tried with all compilers (Project built option), but it is still there.
Please help.
Created the project like:- File->New->Project->Kernel Mode Driver->Next->Next...
If, like most people using Code::Blocks on Windows, you use MingW-TDM (commonly detected as "GNU GCC Compiler" by Code::Blocks, and bundled with the "easy install" package), the file ntddk.h is located in the ddk subfolder of the system include folder.
Thus, you either have to add the ddk folder to the include search path, or write #include <ddk/ntddk.h>, either will work.
Your list of compilers does not seem to include the DDK compiler
Do you have the windows DDK installed?
NOTE: I know nothing about codeblocks but you will need the DDK compiler to compile windows drivers.

Launch Failed Binary not found Eclipse for C in Windows

I installed Eclipse CDT plugin and also the following packages:
MinSys
MinGW
I have also added paths to their bin in the PATH environment variable. Even then I am unable to compile and run any sample program in Eclipse.
How can I fix this? Thanks for your concern.
I even faced this error and searched a lot to fix. Fortunately, I figured it out myself.
The following are the things you need to make sure they are set:
Window > Preferences > C/C++ > New CDT project wizard > Makefile Project > Binary Parsers
a) Set it to PE Windows Parser if you are on windows.
b) Set it to Cygwin PE Parser if you are using Cygwin
c) Set it to Elf parser if you are using ubuntu
Window > Preferences > C/C++ > Build > Environment
Now click on "select" and select "Path" variable so that you add you path variables in Eclipse.
Now its all done!
All you have to do is write a test program and press Ctrl+B (Build all; there is a button on menu bar) and after that click "Run".
After all the setup is done.Go to eclipse project --> build all or Ctrl + B then eclipse automatically build up the binaries and other stuffs now run your project
Open project properties (Right click on your project, choose Properties on the menu)
C/C++ Build -> Settings
Click on Binary Parsers tab and check PE Windows Parser
In my case
I just save the programme. Press Ctrl + B to build it.
Refresh it.
Then run the programme.
Now you can see this will work fine.
Build
Refresh the project. A new folder named Binaries will appear now in project explorer.
Now Run :)
This problem happened with me. I found the problem that the anti-Virus that I am using considered the binary file as a Trojan and disable the Eclipse from successfully build it. You need to disable the auto-Protection mode, then build the project and run.
Just happened to me and it was a bit silly.
Eclipse didn't show any errors but apparently there was one in the console window.
Double-check that everything's okay there.
Same issue, but on Mac OS on Eclipse Kepler. Fixed with the following configuration
Right click project->properties->C/C++ General->Run/Debug Settings.
I didn't see any launch configuration. So, I created new and input the following entries. Problems is the name of the application :-). Remember that this will only work for Debug project, not for Release or you will have to update the build setting again. Hope this helps.
Select FCC and CDT as your default builder for project. This could help you to solve the problem. By the way, I also encourage you to use Geany program instead. It works ok as well. It's ready to use just only install gcc through MinGW.
I managed to fix this problem by changing the default builder from CDT Internal to GNU Make, by right clicking the project → Properties → C/C++ Build → Tool Chain Editor → Current builder → GNU Make Builder.
Similar problem was faced by me. Once you are within Eclipse IDE try doing the following.
Windows -> Preferences -> C/C++ -> Build -> Environment -> (Add environment variables) -> Click on select all) -> OK
Now, in the same dialog box
New C/C++ project -> Make file project -> Choose Respective Parser* -> Click on Apply and Apply and Close.
Choosing a parser
For Linux - Choose 'Elf Parser' or 'GNU Elf Parser'
For Windows - Choose 'PE Windows Parser'
For Mac OS - Choose 'Mach-o Parser' or 'Mach-o 64 Parser'
Try Building your program and running it. If you still find the Binary Failed Error, Do the following :
Click on Run -> Run Configuration -> C/C++ Application -> click on project_name debug -> click on browse and select your project file -> Press Ok -> below it Browse binary file ( Goto your Eclipse Workspace and select your project file -> You'll find two files 1.Debug 2.Src -> Click on Debug file -> Next click on the file with your project name and Press ok) -> then click apply and press run button.
This should solve the problem.
add third party libraries if in case you are trying to compile OPEN SANKORE project in other projects try to install third party libraries to linux
sudo apt-get install zlib1g-dev libjpeg62-dev libtiff4-dev libmng-dev libpng12-dev
libdirectfb-dev libgstreamer-plugins-base0.10-dev libgstreamer0.10-dev libpulse-dev libaudio-
dev libasound2-dev libfreetype6-dev libfontconfig1-dev libts-dev libcups2-dev libdbus-1-dev
libglib2.0- dev libgtk2.0-dev libx11-dev libxext-dev libxcursor-dev libxfixes-dev libxrandr-
dev libxrender-dev libxv-dev libxinerama-dev libxi-dev libsm-dev libssl-dev libphonon-dev
libt1-dev libpaper-dev
I faced the same problem and tried above methods but no use and when I tried to execute in command prompt it gave me "Application not launched properly ...." error and then I tried with code block it gave me "Application not launched properly..." error. Then I downloaded MinGW from
http://www.equation.com/ It started to work
Even I have faced this similar problem and reason behind this problem is pretty simple that compiler failed to get binary file of your written code.
So where is your mistake ?
Answer is there is something wrong in your eclipse installing process. Yes you have not installed it correctly
Here is solution
First thing is no one know where is defect in installing process even you don't know about that.
and here is tutorial "How to install eclipse correctly".
How to Install Eclipse On Windows for C and C++ Correctly
Trust me after watching this you will find your mistake and binary will be found by your compiler.
Watch this whole 8 minute video, this is only solution I found after 7-8 days of hard work.
I had the same Issue of "binary not found" and I had tried all of the solutions but unfortunately nothing worked. I was trying stuff and found out that when I switched my current toolchain(right click on project click settings->c/c++ build->tool chain editor) Cross GCC to Cygwin GCC, clean all build all and guess what ? I am able to run !!

Resources