My eclipse with Version: 2022-12 (4.26.0) and Build id: 20221201-1913 reacts strangely when it comes to the build output location.
I have a small C/C++ Projekt with a single makefile and use gtkmm3. Under "Edit Configuration" - "Build Settings" - "Build Output Location" I can chose between "1. Build in project directory" and "2. Build in configuration specific directory". I set this to 1. Build in project directory.
It works. I get some error logs of this kind: "Indexed 'HausRegelung' (2 sources, 176 headers) in 8.68 sec: 13,582 declarations; 21,405 references; 6 unresolved inclusions; 0 syntax errors; 53 unresolved names (0.15%)" but can run my program anyhow. I can make changes - rebuild - and it works.
If I restart eclipse and perform a rebuild, I get this message:
Building in: /home/bejo/eclipse-workspace/HausRegelung/build/default
make -f ../../Makefile
find: ‘./src’: No such file or directory
g++ pkg-config --libs gtkmm-3.0 -o build/HausRegelung
find: ‘./src’: No such file or directory
/usr/bin/ld: cannot open output file build/HausRegelung: No such file or directory
collect2: error: ld returned 1 exit status
make: *** [../../Makefile:32: build/HausRegelung] Error 1
Build complete (2 errors, 0 warnings): /home/bejo/eclipse-workspace/HausRegelung/build/default
The project directory is "/home/bejo/eclipse-workspace/HausRegelung" and not "/home/bejo/eclipse-workspace/HausRegelung/build/default". The curious thing is, that when I enter the "Build Output Location" and change it - hit save - reenter the "Build Output Location" and change it back to what it was before (Build in project directory) - save it and then go for a rebuild everything works fine. Basically, I effectively do not change anything. But it has an effect.
What do I have to set, to not have to do this "Build Output Location Dance" every time and only once, eclipse is started?
Related
error:
Build input file cannot be found: *(this contains the folder and
project info) *.../build/Debug-iphoneos/StaffIS.app/StaffIS'. Did you
forget to declare this file as an output of a script phase or custom
build rule which produces it? (in target 'StaffIS' from project
'StaffIS')
Then it complains that:
The following build commands failed: ExtractAppIntentsMetadata (in
target 'StaffIS' from project 'StaffIS') CopySwiftLibs *(this
contains the folder and project info) *
/build/Debug-iphoneos/StaffIS.app (in target 'StaffIS' from project
'StaffIS') (2 failures)
It compiles just fine in Xcode, never an issue. I don't see any StaffIS files in the project, it is the project name however.
I simply want to run a command-line build without failure.
I am trying to build a small project to create a library of functions I use often.
I am expecting to do only the compiling without linking. So my end output should be a .o file and not an executable.
Any way to change this (I dont want to write a make file ).
At the moment, it is giving the below error since it is using -o and my project does not have a main.
(.text+0x20): undefined reference to `main'
collect2: error: ld returned 1 exit status
make: *** [util] Error 1
You have two options.
Create a "library project" via the "New" -> "Project..." wizard. Eclipse CDT will provide a default configuration that instructs the compiler to create an object file instead of an executable.
You can change the configuration of your existing project. To do this, right-click on your project, and select "Properties". Then, navigate to "C/C++ Build" -> Settings. Switch to the "Build Artifact"-tab, and change the "Artifact Type" to either "Shared Library" or "Static Library".
Hope this helps.
I am trying to program the Arudino Nano from Eclipse. It has the same processor as the Uno (Atmega328p). I have had this working before with the Uno, but have since gotten a new hard drive and had to reinstall/reconfigure everything. I am running Fedora 19 with Eclipse Kepler. I am getting an error in the build process that I don't even know where to start looking to solve, and Google hasn't been much help...
Here is the error:
make all
Building target: Arduino_Template.elf
Invoking: AVR C Linker
avr-gcc -Wl,-Map,Arduino_Template.map -mmcu=atmega328p -o "Arduino_Template.elf" ./Analog.o -l/usr/avr
/usr/lib/gcc/avr/4.8.2/../../../../avr/bin/ld: cannot find -l/usr/avr
collect2: error: ld returned 1 exit status
make: *** [Arduino_Template.elf] Error 1
17:29:38 Build Finished (took 124ms)
Has anyone encountered this before? Or does anyone have any suggestions?
Thanks.
The problem could be described like this:
First, the library should be specified only by its name and without the "lib" prefix and the ".a" suffix. The linker (this is where you get the error) will look for the library within the specified in the project paths and will add whatever is necessary to the file library name. So if the library you need is named mystuff it will look for a file named libmystuff.a.
In your case this is specified by the -l/usr/avr which I think could be misconfiguration or you did not copy/paste the entire error output. With the '-l' option you specify the name only, not the entire path to the file.
Second, the path should be specified, in the project configuration, where to look for the libraries, otherwise the linker will look for the library files only within your own project only. Often libraries are part of another project - so you need to adjust the project configuration accordingly.
I had similar problem and this is how I solved it ...
Go to menu Project/Properties. On left - choose "C/C++ Build". On right - choose the tab "Tool Settings". On the tree view choose "AVR C Linker" then "Libraries" sub-item. You are where you may need to make changes.
The list of "Libraries" is where you add libraries names, such as mystuff.
The Libraries Path is where you specify the paths to the libraries. This may look like this: "${workspace_loc:/mystuff/Release}"
The result of this is that the linker will look for this file: /mystuff/Release/libmystuff.a under you workspace root folder.
Below is the error that I get when I try to build my project. I am unsure what file or directory it is talking about. All the files and directories are within the project directory.
I followed the instructions in http://arduino.cc/playground/Code/Eclipse to set up my IDE.
Should the Arduino core files be within the project directory and specifically added to the Arduino core library? All I gave it was the liArduinoCore.a file that was produced by my Arduino IDE. Could this be the issue?
The error message
**** Build of configuration Debug for project CustomLEDPoi ****
make all
Building target: CustomLEDPoi.elf
Invoking: AVR C++ Linker
avr-gcc -Wl,-Map,CustomLEDPoi.map,--cref Wl,--gc-sections - L"C:\Users\Justin\workspaceArduino\arduino_core\src" -L"C:\Users\Justin\workspaceArduino\arduino_core\328P_16MHz Arduino\src" -L"C:\Users\Justin\workspaceArduino\CustomLEDPoi\arduinolib" -L"C:\Users\Justin\workspaceArduino\CustomLEDPoi\lib" -mmcu=atmega328p -o "CustomLEDPoi.elf" ./src/glowstick2.o ./lib/CShiftPWM.o ./lib/MeetAndroid.o ./lib/hsv2rgb.o ./arduinolib/HardwareSerial.o ./arduinolib/SPI.o -lArduinoCore
avr-gcc.exe: Wl,--gc-sections: No such file or directory
make: *** [CustomLEDPoi.elf] Error 1
**** Build Finished ****
It seems that a - is missing for Wl,--gc-sections. It should actually be -Wl,--gc-sections. Without the proper flag, the compiler assumes that it's a source file. You should check the makefile and verify.
This feels silly, but its been 2 days...somewhere after upgrading from Ubuntu 10.04 to 10.11 and from Eclipse Helios to Eclipse Indigo, I got stuck with the following problem:
Problem Description:
I'm trying to use a function in math.h called isinf(), but the problem also occurs with things like isnan(). The program compiles fine on the command line using make and fine in eclipse using build. But if I open the program file in eclipse it reports that it cannot reolve the isinf() function call. If I just insert the program contents into a new project and new source file, the error appears immediately. This problem did not occur under 11.04 with Eclipse Helios CDT
Questions:
Why are these errors only reported when the program file is opened and not on when the program is compiled; why are the errors not detected make is run from the command line? Is there a solution/workaround available?
Version Info
Linux Ubuntu 10.11 64-bit
Eclipse CDT Indigo, Service Release 1, Build id: 20110916-0149
(Also using Eclipse EE Indigo – if that makes a difference)
GNU Make 3.81
gcc 4.6.1-9Ubuntu3
To Duplicate:
Please find the two files you'll need to replicate below:
Step 0. Verify that everything is fine outside of Eclipse
Copy the attached source file and make file
create a directory e.g. Mkdir FunTest
Save the source file a 'Test.cpp' and the makefile as 'makefile'
Open a command prompt and navigate to the directory e.g. FunTest
Enter 'make'
Enter ./TestOut
Program responds “is not infinite”
Step 1. Create the project in Eclipse
Open Eclipse
Select File|New|MakeFile Project with Existing Code
Click Browse – navigate to the directory (FunTest) and click ok
Select 'Linux GCC' from the Toolchain selector
Click Finish
Step 2. Find the Error
Click Build All (Ctrl-B) – project builds without errors
Open the project in the project explorer to display the file in the directory
Double click on the file “Test.cpp”
Note the error icon next to line testing for infinity
Note the 2 error messages:
Semantic error: Function _isinff could not be resolved
Semantic error: Function _isinfl could not be resolved
Test.cpp:
include <math.h>
int main(int argc, char **argv)
{
int TestNum = 10;
if (isinf(TestNum) == 0)
printf("Not infinite\n");
return 0;
}
makefile:
# Specify the compiler
CC = g++
# Specify the compiler flags
CFLAGS += -c
# Specify the files making up the application
SOURCES = Test.cpp
OBJECTS = $(SOURCES:.cpp=.o)
EXECUTABLE = TestOut
all: $(EXECUTABLE)
$(EXECUTABLE): $(OBJECTS)
$(CC) $(LDFLAGS) $(OBJECTS) $(LDLIBS) -o $#
.cpp.o:
$(CC) $(CPPFLAGS) $(CFLAGS) $< -o $#
install:
#echo "Build complete!"
I have experienced similar problems of the CDT reporting errors even though the code compiled fine within Eclipse Indigo.
Project > Properties > Settings > Binary Parsers > "GNU Elf Parser"
helped in my case. I had the "Elf Parser" checked.
That looks like a problem that many others have had with eclipse CDT before. Sometimes shutting eclipse down and then starting it back up again is enough to help. If that isn't the case, take a look at what I have below:
Compilation ok, but eclipse content assist having problems
Check your includes: if you're using include<math.h> change it to include<cmath>. The same for stdio.h and stdlib.h, you should replace by cstdio and cstdlib. Another option may be change you project to a C project instead of a C++.
You are missing -lm option in your build preferences.
Project->Properties->Settings->Miscleanous->Other (linker) flags[]
For me, it was solved by adding a specific ‘Source Location’ folder, and removing the default. In Luna, it is under:
Project > Properties > C/C++ General > Paths and Symbols > Source
Location