Im having trouble to use Gecode (http://www.gecode.org/download.html) framework for my project.
I downloaded and installed the framework. Now it can be found under
/Library/Frameworks/gecode.framework
I created a new "Command Line Tool" project, and selected "C++" for the type.
Then I opened the Target of my project and added gecode.framework in Build Phases -> Link Binary With Libraries
In Build Settings for the path i added following path for "Header Search Path" : /Library/Frameworks/gecode.framework
Now i tried to build a sample code with following includes:
#include <gecode/driver.hh>
#include <gecode/int.hh>
#include <gecode/minimodel.hh>
--> Xcode is complaining that file is not found.
I tried to compile in terminal with g++ and llvm-g++, it compiles without any warnings or errors
To make GeCode or any other framework work in Xcode you need to do the following.
Install the framework (Obviously!! GeCode Link here)
Open the project in Xcode
Select the project file from the project navigator on the left side of the project window.
Under Linked Frameworks and Libraries, click the + sign.
Select the framework from the list display or else click on Add Other if your framework is not found in the list.
Press Command+Shift+G and enter the path directly. In my case for gecode it was /Library/Frameworks/ and then select the desired framework you want to include in your project and then press open.
Go back to you project file and press Command + r and Voila!! it should work.
Cheers!!
Well, i don't have the full solution, but part of it: add the path of your frameworks (e.g. /Library/Frameworks) to the "Framework search path" of your projects.
After that, the compiler does not complain anymore, and autocompletion works fine. But the linker still complains about some symbols not found, when linking.
Related
I'm trying to get "go to definition" working for a JUCE project created with Projucer. I've tried both CLion and Visual Studio Code, but they can't seem to find definitions that live in the JUCE libraries.
I'm on Ubuntu. Is there a blessed path for this? I'm normally a vim user, but I'm willing to try any IDE.
I've just figured this out!
In VS Code go View and Command Palette and type C/C++: Edit Configurations (UI) which will take to the IntelliSense Configurations page. Under Include path, on a new line, specify the path to JUCE e.g. ~/JUCE/**.
Note: The two stars are needed to tell VS Code to look through subdirectories.
This will create a hidden folder .vscode in your project folder with this configuration.
You will need to repeat these steps for each project you make.
Definitions and code completion should now work.
To compile your code, in your project folder go Builds then LinuxMakefile and in a terminal run the command make. Finally, go to the builds folder and run your project ./exampleProject.
You need to add the JUCE/modules folder to your search path, not the top-level JUCE/ folder!
If you're using the Projucer, you'll also need to add the JuceLibrarySource/ folder to your search path.
What I ended up doing was using FRUT to convert my project from a Projucer project to a CMake project. CLion was able to understand the CMake project, and thus, the "go to definition" and autocomplete features started working.
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.
I cannot find a way to add boost in Xcode 11.2.1. I found a setting under the target called "Frameworks and Libraries". I dragged the boost directory there, and it got added to the "Frameworks" section of the project. However, in building the project, it says "file not found". For example:
#include <boost/lambda/lambda.hpp>
results in a "file not found" error. Instead of adding boost, I dragged the entire include area of Macports. It took a while for Xcode to parse through that, but I get the same error. So, under Frameworks it has "include", but it cannot find the relevant hpp file, even though I checked and it's there in the boost tree.
I have installed boost via Macports. It resides in /opt/local/include/boost.
In the Xcode documentation, I saw a reference to "USER_HEADER_SEARCH_PATHS". I figured how to set that in a configuration file, so I added a configuration file to the project. I added this to the configuration file:
USER_HEADER_SEARCH_PATHS = /opt/local/include/boost
but that does not work either. (If I remove the boost, that does not work either).
When I select "include" in the Frameworks location of the project, I see that there are different settings "Identity and Type" for that object (right side of Xcode window). I selected "absolute path" and it shows the full path as /opt/local/include which is correct. However, this does not solve the problem either.
Do I need to create a link in a pre-defined area so that Xcode can find it?
I did find a rather ugly work-around: create a soft link to the boost library in the same area where the STL resides (within the Xcode.app directory structure).
Using the setting only works with individual files. I can add individual file to the setting (via drag and drop), but it won't follow nested directories, so clearly this will not work for a library implemention such as boost.
I prefer to keep dependent libraries inside project area. So here is how I just do it for test:
Create new TestBoost project in Xcode from macOS Command-line App C++ template
(now there is TestBoost folder where TestBoost.xcodeproj is located)
Download latest boost boost_1_72_0.tar.gz and unarchive it
(now there boost_1_72_0 folder with boost)
Copy boost_1_72_0 folder inside project TestBoost folder, so it is located aside of TestBoost.xcodeproj
In Xcode Project Navigator select TestBoost project > select TestBoost target > select Build Settings tab
In Search Paths section select Header Search Path, double click on value area and enter ${SRCROOT}/boost_1_72_0 (leave non-recursive flag)
Delete default main.cpp from TestBoost target (to avoid main function confusing) and add some example from boost for testing, eg. boost_1_72_0/libs/algorithm/example/search_example.cpp
Build & Run > Success
Output:
I'm having trouble getting Crypto++ to work from within the C++ Eclipse IDE. I think I installed it correctly, but every time I try to do any sort of include in the file so I can use the new library, it does not compile. It will compile C++ normally, but it won't let me use the new library. (Bear in mind, I am not too familiar with this whole process with libraries as a whole.)
My process:
Downloaded 7.0 from here: https://www.cryptopp.com/#download
Unzipped it into a folder on my Desktop called Crypto++
Created a new project, it compiled.
Right click on new project, properties -> C/C++ Build -> settings ->
Tool settings
Clicked add, file system, and then clicked the folder I created, and
hit apply.
So, it is listed under library search path, but this include does not work:
#include "cryptlib.h"
Did I install the library properly, or am I missing something?
Edit:
fatal error: cryptlib.h: No such file or directory
i am trying to use opencv library with code blocks(8.02).i have installed opencv2.1.
when i include the headers and link the library its all fine.i have gone through http://opencv.willowgarage.com/wiki/CodeBlocks tutorial as well.but when i compile the project
it reports no error or warning.it just says exit with status 1.
i want to know if anyone who has used opencv with code blocks and can please help me out of this situation.
thanks!!!
I had this exact same problem a couple of weeks ago and couldn't find an answer anywhere !
After messing around with it, I found out exactly how to do it.
1) Compile the library using Cmake. http://www.cmake.org/
2) After your library is compiled you should have two different OpenCV libraries - a compiled one, and a non-compiled one.
3)In Code Blocks, click on Settings (In the File Menu). Under Settings, select Compiler and Debugger.
4)Select the Search Directories tab.Select the compiler tab under search directories. Click Add. Browse to your NON-COMPILED version of the library. In the non-compiled directory, select the include folder. Under the include folder, select OpenCV. Click OK
5)In codeblocks, select the linker tab, which is under the Search Directories tab.. Click on add and this time browse to your COMPILED version of the library. In the compiled directory, select the lib folder and click OK.
6) Go to the linker settings tab in codeblocks. Click Add. Browse to the COMPILED version of the library. In the compiled directory select lib. In the lib folder select all the libraries. Make sure to only select only the dynamic library files (.dylib extention)
7) Codeblocks is setup!
8) Run your project and it should work fine.
Feel free to ask for more help if you are still having problems.