Build failed with no stated reason on Segger Embedded Studio after adding custom source files - build

I'm modifying a simple example project (blinky) from the nRF SDK. I added a header file and a .c file in a new folder inside the project directory then added that path ./lib to the common preprocessor user include directories. I then included the header to main.c.
I can compile the new library on its own but when I build the whole project, I get Build failed error with no stated reason to follow up.
Here is an image of that:
Does anyone here know how to beat this?

I haven't used Segger Studio specifically, but it seems to be the CrossWorks IDE underneath.
In CrossWorks, you have to do the following:
Download & install all relevant libs from inside the IDE, under Tools -> Packages -> Install packages. Grab your specific target MCU as well as any specific boards or libraries you'll be using. In case some needed lib is missing here, you will get very weird errors.
In the project, click on the project name itself in "project explorer". Then in the properties window, check settings (this is a bit different in different versions of CrossWorks, might have to right click and pick properties in older versions). Under "user include directories" you should have something like this:
$(DeviceIncludePath)
$(TargetsDir)/NameOfMCU/Include
$(PackagesDir)/CMSIS_4/CMSIS/Include
$(ProjectDir)/NameOfDirectory
Where "NameOfMCU" is the name of the MCU family used, CMSIS should be there in case you are using any ARM, "NameOfDirectory" is the name of your custom directory (you can add several).
Also, get the debug build working first, before switching to release build.

Related

How can I tell Visual studio where my additional .dll files are?

I have recently switched my IDE to Visual Studio 2019 for C++ projects. I easily followed a tutorial into setting up a new library like SFML into visual studio, and tell it where the additional include and library directories are.
But there is something else that is required for it to work, which are the .dll files. Every page I followed, even the Documentation by the SFML website, it says that they have to be in the same directory as my project. That means I need to copy-paste the 7-8 files into my project directory. This really makes the folder look untidy. I would like to create a new folder and tell Visual Studio where those files are. I tried going doing this
Project -> Properties -> Linker -> Input -> Additional dependencies
Usually, the lines that would work are
sfml-system-d.lib
sfml-window-d.lib
...
I tried doing $(ProjectDir)valid path\ sfml-files.lib but this gives me the linker error, saying that It could not find the file.
If I simply move the .dlls into a folder without doing anything, the code would compile and link fine. But when it runs, Windows gives me a pop-up box with the same error message.
Here is how it currently looks
Looks really messy, I just want to be able to move them into dependencies like how src contains the source files.
How can I achieve this?
As it is now, it works perfectly fine. The issue only occurs when I try to create a new folder.
I hope I have covered the important information required for a good answer, If not please let me know what more I should add
Microsoft Visual Studio 2019
Currently running 64-bit platform with Debug configuration. Hence the -d suffix
You could create a path environment for your specified directory, which is like drescherjm’s suggestion. The steps:
Right-click “This PC” -> “Properties”-> “Advance System settings”
Click “Environment Variables”
In the System Variables group, edit “Path”
Add your directory, for example: ”D:\ SFML-2.5.1\bin”
Restart your visual studio and re-open your project
The easier solution might be to put them in the x64 subdirectory. This allows you to have various builds side by side (x86/x64, debug/release).
Since this x64 directory is where the EXE is located, it is the first directory searched for DLL's. It will take precedence over the Path solution suggested in the other answer. The Path directories are searched last of all.

visual studio c++ project cannot find .dll

I have downloaded the Autodesk fbx sdk and trying to build a simple console app. I have added additional directories in Linker / General / Additional Library Directories like follows:
see the screenshot of the directory below. There are several libs that (I suppose) I should add in dependencies, and there's also the .dll file. It's release folder (debug is another available), for x86 architecture and for VS2017 which I am using.
Also, I have add dependencies like below and have included the standard include folder as specified in the Autodesk manual
The project builds fine but shows the following when run:
Cannot run code because libfbxsdk.dll could not be found...
But it is in the folder as you can see in the pic. Could you pls help?
The linker settings have nothing to do with finding DLL files at run-time. If you want this SDK to be available to all programs - which without reason to do otherwise would be my recommendation - hit the start button and search for "environment", choosing "Edit environment variables for your account". Edit the value of the PATH environment variable (adding it if necessary) to include the directories where the DLLs are located.
If you only want it to be available to this particualr program (and you don't have any other custom DLLs that need to be found) you could also change the startup directory in the project properties to the directory where the DLL files can be found (the startup directory is one of the locations in the system search path).

Using ITK with xcode

I am working on an xcode project that requires me to use ITK (a c++ library), I have went through with the installation of ITK, by doing
ccmake InsightToolkit-4.13.1
and then configuring and generating the files, then runing
make
make install
but I do not know how to import the library into the xcode project, where I get the following error every time I try building it:
'itkImage.h' image file not found
I would like to know how could I import it and share it with other people on different computers.
The #include directive comes with two flavors:
With quotes (#include "file.h")
With ankle brackets (#include <file.h>)
The first usually refers to files relative to your project directory. The second is for system libraries.
You can influence the search path in the project setting:
double-click on the project in the project explorer
Click on Build settings
Click on your target
Click on All to view also hidden options
In the section Search Paths you can then update the header search path to include the absolute path of you rlibrary headers. Attention: you have to do this for the Debug and for the Release builds:
This will solve the error that you have reported.
Remark: be careful, because after this is solved, you could experience some other issues related to the good use of the library, as pointed out by drescherjm in the comments (link about registration of custom classes to the library's fatories if Cmake is not used to compile the project)

Build project has encountered a problemm Eclipse C++.

Details are saying I have two different tools of the same compiler. I'm not sure where to go from here to fix this so I can build my project. Any ideas?
This is the detailed message:
Errors occurred during the build.
Errors running builder 'CDT Builder' on project '263_Hw'.
Internal error building project 263_Hw configuration Debug
Generated resource conflict:
two resources of the same name: /263_Hw/Debug/main.o
generated by different tools
tool1: GCC C++ Compiler
tool2: GCC C++ Compiler
Generated resource conflict:
two resources of the same name: /263_Hw/Debug/main.o
generated by different tools
tool1: GCC C++ Compiler
tool2: GCC C++ Compiler
Internal error building project 263_Hw configuration Debug
Generated resource conflict:
two resources of the same name: /263_Hw/Debug/main.o
generated by different tools
tool1: GCC C++ Compiler
tool2: GCC C++ Compiler
Generated resource conflict:
two resources of the same name: /263_Hw/Debug/main.o
generated by different tools
tool1: GCC C++ Compiler
tool2: GCC C++ Compiler
The most likely situation: you have two source files with the same name but different file extensions. In your case, that would likely indicate you have something like
main.c
main.cpp
in your project tree. Could be tricky to see, especially if you have a lot of nested folders. I'd go to your source root and do a search for main.*
In Ecplise, right Click on project -> Properties -> C\C++ Build -> Tool Chain Editor. In the 'Current Builder' select box, select 'Gnu make builder' -> Apply (or Ok).
Try building the project again.
If you've exhausted all other options try using the gcc make tool directly:
1) Open the command line
2) cd to the folder containing the Make files (i.e. # cd 'C:\Path\To\MakeFile')
3) Assuming you have a typical MINGW windows install, run the command # C:\MinGW\bin\mingw32-make.exe all
4) the above command can be shorter if you have the MinGW folder set as a path variable.
5) The output binaries should be found in the bin folder in the same location.
Hope this helps anyone.
I have seen this same problem before but i don't remember what i did about it! For starters one way to try to solve it is by checking if you have more than one MinGW folder installed on your computer (I am assuming you use MinGW)! Also Check your project properties->c/c++ General->Paths and symbols->Includes and making sure that there are links to only one minGW folder! (It may look something like this (except for you they may start with "c:/mingw/...":
My solution was to delete the project (not the source code, just remove the project from Eclipse) and recreate it from scratch and setting up the include paths and linker paths again. Then it compiled properly.
This happened to me after I deleted a project from the workspace. I reimported the project with the same name to the same workspace, and when I tried to rebuild I got this error.
What I did was to delete the project from the workspace again, and then check my local directory where the workspace folder is. Voila, the deleted project is still in the workspace folder. So I deleted that project folder, then reimported the project again. It worked for me this way ;)

Importing third-party library source files into Eclipse CDT

I've got a project set up very nicely with eclipse-cdt. I'm not building from eclipse, but the indexer works and all my makefile settings were picked up, including third party libraries headers.
What I would like, however, is to be able to view the actual source of those libraries - say, if I want to see some code in Qt or libc I'd like to be able to CTRL+click into the method from the relevant header file. You can do this in the java version of eclipse, whenever you are missing a source file, you have an option of "attaching source". I've looked everywhere with CDT and can't find a solution. I don't want to build these third party libs, I just want to be able to click-through to their source code, not only to their headers.
Does anyone know how to do this (am I missing something obvious)?
Ok, found the answer.
In the Project's Properties window, under "C/C++ General" there is a tab called "Source Location", your project's folder should be listed there. Click on "Link Folder", mark the "Link to Folder in the file system" and use "Browse" to find the folder where all he library's source code is.