The program file specified in the launch configuration does not exist - c++

I am facing some problems regarding eclipse for c/c++. I am trying to create a new project, I provide the code, and after running the code I get this error:
The program file specified in the launch configuration does not exist
C:\Users\elisabeth\workspace\mm\Debug\mm.exe not found
Please notice that I am working with spice toolkit; I set the path for the "include" files and the libraries, but still I can not have a result.
What causes this error and how can I resolve it?

Right click on your project --> Properties
Run/Debug settings
Delete whatever is set as "launch configuration for '........'
Project --> Clean
Project --> Build Project

You can create a run configuration. Go to Run > Run Configurations. Click New button, fill C/C++ Application field, i.e., insert path to your executable. The new configuration will appear in the list which appears when you click to the arrow next to run button.
Of course this assumes your can build without problems, otherwise you won't see an executable to point to.

You can clean the project, build it again and run it as a local C/C++ application. Simplified steps as follows,
Right click on the project
Clean Project
Again Right click on the project
Build Project
Again Right click on the project
Run As ->
Local C/C++ Application

As the error reads:
C:\Users\elisabeth\workspace\mm\Debug\mm.exe not found
First of all you need to check whether there is an executable "mm.exe" in your Debug folder. (Of course, it is not there and that is why the error)
Go to Project > Clean
and you should see some files being deleted from your Debug folder
Go to Project > Build Project
and you should see some new files being generated e.g. mm.d, mm.o, mm. This "mm" is probably the executable you're looking for
Now that you know what your executable is, you should tell eclipse what file to execute instead of mm.exe. Go to Project properties and in run debug settings create a new configuration (or edit an existing configuration, if there is one already). In this configuration, in main tab, in C/C++ Application specify a full path to "mm". Which, in your case is - "C:\Users\elisabeth\workspace\mm\Debug\mm"
A better way to do this in eclipse is:
${project_loc}/"your folder"/"your executable file"
e.g.${project_loc}/Debug/mm

what worked for me is file->refresh
then do the Debug configuration again by choosing the right c/c++ binary again.

Avoid troubles with configuration by going into Project properties > C/C++ build > Refresh Policy and specify your project folder. The configuration option "Search project" will show a correct folder then and you will see whatever you build there - Debug, Release or both. You don't want to specify the folder using Browse option every time you import project or switch configurations.

As this is the first SO discussion that appears for this topic on Google and none of the answers solved the problem my students were having, I would like to mention the solution we eventually found from this answer:
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
Keep clicking Move Up until it is at the top
This had been set to Elf, even though we were using a freshly downloaded Windows version of Eclipse.

sometime missed closing curly brace can be part of a problem. Make sure prototype your function at the beginning of the file. Then right click your project in the left side bar. click clean project. then click build project and finally run project

I encountered similar issues and their related problems a few days ago. Finally, I found out that, just because I had moved my project folder (workspace folder of Eclipse) to another place so Eclipse could not find what its need as usual.
Solution: I just set the workspace to my new place (Hey Eclipse, my workspace now is here) :
Menu "File" -> "Switch workspace" -> "Other..." -> click "Browse..." button and point to new place then click "Select Folder" button and click "Launch" button.
Nice day.

Related

How do I run multiple program in codelite

I had to do my homework with c programming in codelite. Just like codeBlock and Dev-C++ which give user to run multiple console program in the same folder, however, when I run it on codelite it fail.
I have create different workspace folder or even different project.But when I try to build it, only the first c file get to build but not later created c file.
May anyone please help me on this issues?I just want to rum multiple program in codelite just like code block.
Hitting F7, builds the active project (the project with a bold text in the workspace tree view).
To change the active project:
Double click a project, or:
Right click a project and select Make active
To build all the projects in a single click (Default key: F7):
Add new project to the workspace
Right click it and select Build Order
In the dialog that pops up, click on the checkbox near each project
Build the dummy project (make it active as described above) and hit F7
OR, build the entire workspace (Ctrl-Shift-B):
From the menu bar select Build -> Build Workspace (default key bindings: Ctrl-Shift-B)
To execute a project (default key binding: Ctrl-F5):
Make the project active by double clicking it
Hit Ctrl-F5
NOTE:
All keybindings can be changed from Settings -> Keyboard shortcuts
HTH,
Eran

How to run .exe immedeatly after build in Eclipse CDT [duplicate]

I'm trying to conveniently have the updated code in effect when I click the run button in Eclipse. At present it will run the last build and I have to manually click build before clicking run to see the changes.
Can someone advise me on how to configure Eclipse to autobuild the current project (if changes has been made) before running the code?
There are multiple settings for auto building. The one you could be missing is the setting under Launching.
Two other settings are here:
And the last setting is the one you likely already know about:
If you want to automatically build your project on save (or before run, if needed), then from tool-bar menu go to
Project -> Properties -> C/C++ Build -> Select Behaviour Tab on the right panel, -> tick the "Build on resource save(Auto build)" , finally hit OK
That is it...

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.

How to enable Eclipse to autobuild/autosave changes before run (CDT)

I'm trying to conveniently have the updated code in effect when I click the run button in Eclipse. At present it will run the last build and I have to manually click build before clicking run to see the changes.
Can someone advise me on how to configure Eclipse to autobuild the current project (if changes has been made) before running the code?
There are multiple settings for auto building. The one you could be missing is the setting under Launching.
Two other settings are here:
And the last setting is the one you likely already know about:
If you want to automatically build your project on save (or before run, if needed), then from tool-bar menu go to
Project -> Properties -> C/C++ Build -> Select Behaviour Tab on the right panel, -> tick the "Build on resource save(Auto build)" , finally hit OK
That is it...

Eclipse indexing not working

I am using CDT in Eclipse 3.5.2 Galileo in Ubuntu.
My eclipse's indexer doesn't work at times. By that I mean when I ctrl click a function it says Could not find symbol in index. Also, F3 button click results in the same error message. Actually most of the places it is not working and works in very few places.
I have seen some other versions of Eclipse where under File menu a menu item listed for Indexing. Like File->Indexer->Rebuild.... But in my File menu there is no such menu item for the Indexer.
Will the only way be to use some other release of Eclipse or am missing something? Any pointers regarding this would be helpful.
In my case nothing has worked and at last I did the following:
1) Close the project
2) Delete the project(do not check from disk option)
3) create new project with existing code(use the deleted project path)
4) Successfully indexed my c++ code
To add paths containing code to parse, follow these steps :
1. Right click on the project
2. Select Properties
3. Go to C/C++ General
4. Go to Path and Symbols
5. If the paths are missing, add paths.
To re-parse the code follow these steps :
1. Right click on the project
2. Select Index
3. Rebuild
If this doesn't work, then you are out of luck. c++ is very difficult language to parse.
If your indexer is stuck and it hangs for infinite time, you can delete the indexer related files of your project from .metadata. Make sure eclipse is not running in the meanwhile.
The .metadata directory is located as a hidden folder in the path of your workspace.
There you can navigate to:
<workspace_path>/.metadata/.plugins/org.eclipse.core.runtime/.settings/
Inside the .settings/ directory there are .prefs files which store the preferences of each project individually.
For example: org.eclipse.cdt.core.prj-test-project.prefs stores the preferences of the project test-project
Open this file with the text editor and remove all the lines starting with indexer. This will reset the indexer settings for this specific project to the default.
Alternatively, you can remove all the lines starting with indexer from org.eclipse.cdt.core.prefs; doing this will reset the indexer settings for the whole workspace.
I believe you can clear the index by running:
rm .metadata/.plugins/org.eclipse.jdt.core/*.index
And then restarting Eclipse. It will then rebuild its index.
This worked for me in a Java project, but I imagine its the same index for all (most?) project types.
Right click on the project.
Select New->Convert to a C++ Project.
Select your configuration. And then Next
Indexer will start indexing all the files.
For me this worked:
Right click and close the project
Open the project again
Right click and select Index->Rebuild
I hope it helps anybody.
You can try rebuilding the index.
Right-click on the project in Project View. Then Index -> Rebuild.
Here is the solution I used after Project->C++ Index->Rebuild failed. This trick avoid deleting your current project :
1) Copy the current project (Right click->Copy from Project Explorer)
2) Paste it (Right click->Paste from Project Explorer) and give the copy another name
3) The indexer should now start and index both projects
4) When indexation is complete, you can delete the copy
PS: Make sure your original project is an actual C++ Project or this will obviously not work.
Convert a project to C or C++ nature:
Right click on project: New >  Convert to C/C++ Project
In "Convert to C or C++": Choose C/C++ Project
In "Project options": Check "Specify Project Type"
...Project Type: Choose "Makefile project"
...Toolchains: Gross GCC
I was having the same problem and it turns out that the index folder was owned by root (I must have run Eclipse as a root once for some reason) I reclaimed the project folder using sudo chown -R username projectfolderpath and problem solved.
Execute eclipse.exe -clean -refresh where the eclipse is installed.
Create a new C/C++ Project in Eclipse with Given Source code folder path. (Not with New Project based on existing workspace)
Above steps worked for me.
For me it was issue that when creating a project indexer was chosen as none. Deleted the project and while creating the project again I chose the indexer options as per my need "LINUX_GCC", then it worked for me
Just came across the same problem in my C++ ARM Cross GCC project. I'm developing on Windows, using Makefile and an Ubuntu Docker image with GNU ARM Embedded Toolchain to build the project.
The solution to get rid of the unresolved symbols, in my case, could be divided into two parts:
The CDT Arm Cross GCC Built-in Compiler Settings didn't have the path to the compiler.
In the Project Properties -> C/C++ General -> Preprocessor Include Paths -> Providers(tab) the path to the compiler must be provided.
Using the GNU ARM Embedded Toolchain, the entry for the Command to get compiler specs: I currently use is:
C:\GNU_Arm_Embedded_Toolchain\9-2020-q2-update\bin\arm-none-eabi-g++.exe ${FLAGS} ${cross_toolchain_flags} -E -P -v -dD "${INPUTS}"
Note: Yes, I am having installed the same toolchain on my Windows machine as I'm using in the Docker image.
To verify, that the call is correct, you can tick the Allocate console in the Console View, which will provide hlepful output to the Console. Also, in the Entries tab, when you unroll the CDT Arm Cross GCC Built-in Compiler Settings you should see the includes and symbols included.
Missing symbol in the Project Properties -> C/C++ General -> Paths and Symbols menu.
As I have my defines in the Makefile, I forgot to add the define of my MCU also here.
Hope this helps to someone! :)
For the most part, the other answers tackle the situation wherein one "had" a working index earlier and things have gone astray for some reason.
On the other hand, I faced a problem wherein I needed to install everything from scratch (eclipse, workspace, c++ project etc.) and the indexing just wouldn't work. I finally found the solution here: https://www.eclipse.org/forums/index.php/t/1109004/
The key inputs from the above page are:
You need to setup include paths for the Indexer just as you would need
to for the compiler. The Indexer and compiler are completely independent.
The Indexer include paths are set by
Project -->Properties --> C/C++ General --> Preprocessor Include Paths, Macros etc. --> Entries tab --> CDT UserSettings Entries ...
and
You could try using
Project --> Properties --> C/C++ General --> Paths and Symbols
That's supposed to merge telling the compiler and Indexer
in one place.
However, this latter part of the suggestion did not work for me.