Trouble compiling using Eclipse CDT with alternate toolchain - eclipse-cdt

I'm trying to use Eclipse CDT (Version: Indigo Service Release 1 Build id: 20110916-0149) to build and debug my c/c++ project in RHEL6 64 bit Linux, and I'm having issues. I've done what I thought was necessary to use an alternate toolchain to perform the compilation, but something seems to be missing, as eclipse says that it compiled the source, but it didn't really do it.
For the setup I went to C/C++ Project Properties -> C/C++ Build configuring the "Debug" configuration, on the "Builder Settings" tab I unchecked the "Use default build command" checkbox, and entered the name of my toolchain "mk all" into the "Build command" field. I then unchecked the "Generate Makefiles automatically" checkbox. Next I changed the "Build Directory" field to be "". Lastly I went to the "Behavior" tab and unchecked the "Build on resource save (Auto build)" checkbox and changed the "make build target" to be "all ${selected_resource_loc}" .
Now, when I go to my project, and select a subdirectory that needs to be built, and then click on the build button on the toolbar this is what happens:
1) I see the "Build Project..." in the progress window briefly
2) The CDT build console displays this:
**** Build of configuration Debug for project myproj ****
mk all
**** Build Finished ****
The above is what I see when my code needs rebuilt, does not need rebuilt, and when there are errors in the compilation. I can verify this by opening a bash terminal and typing "mk" in the directory I want to build. When I compile from the terminal, I can see the compiler output (success and errors etc..), but eclipse shows me nothing of the sorts.
I must be missing something, but I'm not sure what. Does anyone have any ideas of what I'm doing wrong?
--update--
I found out what part of my issue was, which turned out to be that my build tool was invoked via a bash script without a shebang at the top.
My next issue is that the build is always invoked from the root of the project, which has no makefile. I have tried putting the "${selected_resource_loc}" variable into both the "make build target" field, but it does not seem to have the correct effect as my "mk all" command seems to be invoked with the variable being translated to an empty string every time. Any ideas on this side issue?

'DEAR PEOPLE FROM THE FUTURE: Here's what we've figured out so far ...'
I sorta solved my issue. I had asked a friend with a similar setup to try this out, and he got it to work on the first try. I then concluded that it was either my install or my project. Thus, I proceeded to delete the project files (.project and .cproject) and recreate the project. After I completed that, it seemed to work like a charm. I must have selected an obscure incompatible project option, that caused something to not expand the ${selected_resource_loc} variable. Weird. I hope this helps someone along the way.

Related

"No target" in "no project" issue in code::blocks

Whenever I compile a source code in code::blocks, I encounter an error which tells me this:
Build file: "no target" in "no project" (compiler: unknown)
Below is a link showing the image of a code where I am encountering this issue
compilation problem
THE COMPILER I AM USING IS THE GNU GCC COMPILER.
How do I solve this issue?
For the above code I hadn't created a project.
But when I do create a project I encounter this message:
debug in train (compiler: GNU GCC COMPILER)
I am also attaching an image of the code showing this message
compilation problem
here are the contents of the build log tab
build log tab
Search for the file "guimain.exe" and run.
It should be in the "libexec \ mingw-get \ guimain.exe" directory
Choose to include the "mingw32-gcc-g ++ - bin" package and install this, it will work.
I had the same problem and found that this g ++ does not install installed via mingw.
enter image description here
You could change some of the project settings but I think It'd be easier if you start from the beginning.
Run code blocks and then click create new project -> console application and choose the name and the path of it.
It seems like you've just created the cpp file and opened it in code blocks.
Correct me if I'm wrong.
Make sure your Settings -> Compiler -> Toolchain executables shows the right compiler. Clicking on auto-detect seems to work.
Then create a new project of type Console App (as suggested already). After the project is created, go to the left menu and click on your project, go to Source, and open main.And then delete the "Hello World" code already there and copy/paste in your source.
I did these steps and then Build and Run worked just fine.

Eclipse Luna With MinGW: "Launch failed. Binary not found."

I have searched all over the web and have tried everything I could to fix this problem, to no avail. So here I am making a new post, hoping to fix this terribly frustrating problem.
I have the Eclipse IDE for C/C++ Developers that on my Windows 7 computer. The version of Eclipse is Luna Service Release 2 (4.4.2) and the build ID is 20150219-0600.
I have MinGW installed onto my computer, and I downloaded all the package choices just to be safe.
I create a C++ project. The "Project type" is Executable > Empty Project and the "Toolchains" is "Cross GCC".
I select both "Debug" and "Release" in the "Configurations".
I leave the "Cross compiler prefix" blank because I don't know what to write. I then put in "F:\MinGW" as the "Cross compiler path".
I create a new source file in the project and write the infamous Hello World program (in C++, of course). When I save the project, it gives me two errors in the "Problems" tab:
Program "g++" not found in PATH
Program "gcc" not found in PATH
When I build the project, it adds on another error:
Program "make" not found in PATH
I go to Project > Properties > C/C++ Build > Tool Chain Editor and change the "Current builder" from "Gnu Make Builder" to "CDT Internal Builder".
The error Program "make" not found in PATH then disappears.
I go to Window > Preferences > C/C++ > New C/C++ Project Wizard > Makefile Project and set the "Binary parser" to "PE Windows Parser". I clear the project, save the project, and build the project, but the 2 errors remain.
If I go to Project > Properties > C/C++ Build > Environment and set the value of the "PATH" variable to "F:\MinGW\bin", still nothing happens and the two errors remain.
Now, when I attempt to run the project (ctrl + F11), it spits out the error Launch Failed. Binary not found.
In the "Project Explorer", I see a HelloWorld file that contains an "Includes" file (containing the compiler libraries?), a "Debug" folder (containing a HelloWorld.exe and a main.o), and a main.cpp file (containing my Hello World program).
Thank you in advance for taking the time to read this and for trying to help.
You need to update environment variable PATH. Check this page.
You must add C:\MinGW\bin; to your user PATH environment variable manually.
I suggest, not a solution, at least you want to make sure the following.
Recheck that the PATH is set up right. Sometime we think we did, but the computer does not. In the command line, type the following command to see the gcc installed right and PATH is set right.
gcc --version
echo $PATH
or
echo %PATH%
All things are right as you did above, but it does not work?, Then remove and reinstall mingw and eclipse CDT cleanly. Don't change and keep the default options in the Eclipse CDT. Without any option changes CDT, it should work NOWADAYS. Eclipse CDT(8.7, 8.8) is pretty much stable.
Blessings,
(a debtor)<><

Eclipse C++ Setup, Path to executable not set

I try to program some stuff in c++ with eclipse, but I have slight difficulties.
When I create a new Project compiling and making works fine but when I try to run the Application I get the following error message:
"Launch failed. Binary not found"
So what I found out by using google is this workaround:
-right-click on the projekt in the projekt explorer
-select "run as" and then "run configurations"
-expand "c/c++ application" in the navbar on the left
-and in the main tab of the project select "browse"
-navigate to folder "debug" and select the .exe
after I do that, running works fine but I have to do it again every time I create a new Project, is there a way to automate this process?
And what I also noticed: I don't have a "binaries" folder in my projects in the project explorer, maybe its related to that, but I really don't know.
Any help is appreciated
Thanks
Tim
Edit: added a video: http://youtu.be/RKnTOkoHFRU
There will only be a Binaries folder if the build was successful. You will have to manually build to get a binary in order for the Binaries folder to appear. Likewise, if you clean (remove) your build folder then Binaries will disappear.
I would guess that Eclipse cannot find your binary "out-of-the-box" because you are using external tools to manage the build process; that is, if you have a custom makefile project (or another type of project that uses another tool to handle the building) then Eclipse will not be able to provide a default run configuration because it does not "know" where the binary is or even which binary to run if there are multiple. Thus, you have to set up the Run Configuration as you are doing now.
If you create a project and let Eclipse do the building, then Eclipse can find the binaries automatically. For example, simply create an "Empty C++ Project" under "Executable". Write some hello world code. Click build. Then click run. Eclipse launches the binary because it is managing the build process and thus "knows about" where the binary ends up.
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
as seen here stackoverflow.com/questions/9407430, answer number 3 or 4
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.
I have already answered this for other question see the link Launch Failed Binary not found Eclipse for C in Windows at 10th number.

Netbeans: cannot find include file <iostream>, also, unable to resolve identifier std, cout

I'm receiving the above errors on all my C++ projects on Netbeans. I also receive cannot find errors for anything else I try to include. Here's what it says when I hold control and hover over it: http://imgur.com/bBF2xuB. One of the projects actually builds and runs just fine, but all the rest fail either with "build failed, exit value 2" or the run fails with "run failed, exit value 127". I have absolutely no idea how to fix this and everything I've looked up to try to solve this hasn't helped. This wasn't a problem a few months ago when I was using Netbeans, and I'm not sure why the problem spontaneously popped up.
I just freshly installed Netbeans 8.0 and the latest cygwin version to try to fix this, but to no avail. I'm running Windows 7.
Please help, it would be greatly appreciated.
EDIT
The highlighted red errors in the attached photo are files/folders that do not actually exist. Could this be the problem, and if so, how can I go about fixing it?
EDIT 2
I deleted or changed some of the non-existent file/folder paths in the code assistance tab under the C/C++ tab under the options, this seems to have made some of the errors in the editor go away, but I still cannot build the project (and the errors haven't disappeared on this specific project), and the projects that I created in the past that used to work just fine are building, but I'm still receiving "RUN FAILED exit value 127".
I just had the same experience with Netbeans (8.0.2) not being able to find includes ("Cannot find include file") on Linux.
I had to do the following:
In the "Build Tools" tab under "C/C++" settings, click "Restore Defaults" to let it rescan for the tools, after which it picked up the paths to all the executables. Select the newly configured toolset as default and/or delete the old one to reduce confusion.
Under "Code Assistance", make sure the correct tool collection is selected, then click "Reset Settings" and "Apply". This populated all the necessary paths.
In my project settings, made sure I was using the right (newly discovered) tool collection.
After this, all the includes were picked up correctly and errors disappeared from the source checking.
I also had this problem (Cannot find include file iostream) in NetBeans IDE 8.1. I solved as follows:
Project properties -> Build -> C++ Compiler -> Basic Options -> C++ Standard -> C++98 or C++11 or C++14

How to compile and run a C++ program from Eclipse?

I am trying to write, compile and execute a "HelloWorld" C++ program using Eclipse. I have managed to install and run Eclipse, create a new project and write the HelloWorld program. Now I would like to compile it and to run.
I did not find "Compile" option in Eclipse, but I found "Build Project" option in the "Project" menu. I assume that Build is what I call "compilation". After I clicked this options, Eclipse generated "Debug" folder, containing "src" sub-folder as well as 3 files: "sources.mk", "objects.mk" and "makefile". First, I do not know what these files mean (and which of them is my "executable"). Second, I still need to execute my program. I tried to click "Run" option in the "Run" menu. As a result I got an error message: "Launch failed. Binary not found".
Can anybody, please, help me to compile and run my code using Eclipse.
Eclipse being an IDE is meant to create projects not restricted to just one file as a result multiple files exists which have to be linked and compiled so as to work in sync as per the methods implemented in the project.To run the project or a particular program a binary of that particular project is required which gets created only if the build is successful .So a successful build is must for binary creation which in turn is responsible for running the project or program.
So first build the project using Ctrl+B after succesfull build then run the project.
This simple question was asked nine years ago, so I don't know if it is still active. Anyway, one thing not mentioned in the responses so far that might be helpful to others is that Eclipse requires a "Run Configuration" to run programs. From the original post, if the "Build Project" command returned successfully, then the "Debug" folder should also contain a file called "HelloWorld" at the same folder level as "makefile" and "objects.mk". That is your executable. To run it, go to Run -> Run Configurations, which should produce a popup containing a field called "C/C++ Application". Click the "Browse" button, find, and select the "HelloWorld" executable in the "Debug" folder. Click "Run" in the lower right and you should see your output.