How to make CLion stop flagging PlatformIO dependencies with "file not found"? - clion

I'm experimenting with using PlatformIO and the CLion IDE. I'm pretty new to C++ and writing for embedded hardware. I got PlatformIO working and my simple program compiles and runs but CLion highlights my PlatformIO dependencies as not being found.
I've seen it said that CLion looks where cmake looks, but CMakeLists.txt says
# !!! WARNING !!! AUTO-GENERATED FILE, PLEASE DO NOT MODIFY IT AND USE
# https://docs.platformio.org/page/projectconf/section_env_build.html#build-flags
That URL seems like a dead end in terms of helping me solve my problem.

Update:
I was playing a little bit more with CLion and PlatformIO and wanted to use the library manager as well.
The installed libraries are located in {PROJECT_DIR}/.pio/libdeps/
I was not able to detect all libraries automatically, but with the method described below, I could get rid of the CLion warninings by explicitly defining the dependencies in the CMakeListsUser.txt likes this
include_directories("${CMAKE_CURRENT_LIST_DIR}/.pio/libdeps/mkrwifi1010/Keyboard/src")
include_directories("${CMAKE_CURRENT_LIST_DIR}/.pio/libdeps/mkrwifi1010/WiFiNINA/src")
For the few dependencies I got, this is sufficient. But of course it is not ideal to add every dependency manually. So if somebody has a better solution, please share it.
Original Answer
I stumbled on a similar issue, but maybe this could help you or others.
In my case, I added the ArduinoLog library in the "lib" folder. Although I was able to compile my code, the import showed up as an error and I had no code completion.
As described in the XMakeList.txt, I was able to resolve this issue, by adding a "CMakeListsUser.txt" in the root project directory with the following content.
include_directories("${CMAKE_CURRENT_LIST_DIR}/lib")
After a rebuild and a restart I got no more errors and the code completion worked as expected. Maybe you can add the folder of your PlatformIO libraries there as well.

Seems like the best way to do it is to go to Tools->PlatformIO->Re-Init. New dependencies should stop showing up as missing.
It worked for me.
Source: https://community.platformio.org/t/clion-cant-find-lib-deps-library-headers/23929/2

Related

Incorporating charls into a MacOS application

Charls is an implementation of the JPEG-LS lossless and near-lossless coder/decoder. I downloaded the source code, built it in Xcode, and ran it on MacOS. From a few tests I ran, it seems to be reliable and very fast.
Now I want to incorporate charls into my application. I added the static library libcharls.a to my Xcode project and added the header file charls.h. When I try to do a build, I get the error: library not found for -lcharls. I then added a path to libcharls.a in the Library Search Paths of the Build Settings for the Project in Xcode. Still get the same error. Anyone have suggestions for getting this to build? TIA.
To answer my own question: adding the path to libcharls.a in Library Search Paths does fix the problem, but you only add the path, but not the file libcharls.a.

Missing libraries on compiled gtkmm program on windows (MSYS2)

after numerous issues I finally have succeeded in compiling (Using \mingw64\bin\g++) my program that uses GTK+ 3 (gtkmm3) on windows.
However, trying to run the .exe file now fails and it complains about the following missing libraries:
libstdc++-6.dll
libgcc_s_seh-1.dll
libwinpthread-1.dll
libatkmm-1.6.1.dll
I guess something about my path may be wrong? However I dont really know what to do as I didnt face something like this before. I would appreciate any help and I am willing to provide any information that may be neccessary to resolve it^^
Edit: I know I could just download or locate these libraries to make the program run, but I would like to know why it can't seem to find them as they belong to gtkmm (at least thats true for libatkmm-1.6.1.dll)
I found the answer myself... I have added in my case C:\msys64\mingw64\bin to my PATH variable. But now I face my program immediately closing after opening it. Well I guess the challenge continues ;)

XCode Project - ld: library not found for -llib

Recently I ran into a CMake problem that can be found in this thread:
Cmake on OSX Yosemite 10.10.3 - GLEW: package 'gl' not found
Eventually it got solved, maybe partly due to my inexperience in XCode and CMake. (I mainly used visual studio to compile projects in the past.)
After the alteration in the linked thread I got warning about my GLEW libs in CMake
(Is this something I should be worried about or is it not important?):
MACOSX_RPATH is not specified for the following targets:
GLEW_MX_shared
GLEW_shared
I simply ignored it and tried to compile my project in XCode with the ALL_BUILD target selected. In the sparky target it said the include files in main could not be found so I added the .h files into the inc folder of my project.
When I compiled again the compiler started complaining again
(I don't know what this error means and how I can fix it.):
ld: library not found for -llib
Googled it for the entire day now and I can't find anything to solve this issue.
It's so frustrating working with XCode as an IDE but I really want to learn more about different platforms and their most popular IDE's so I can make multi platform applications from the start instead of porting it afterwards.
And if it matters I am using OSX Yosemite 10.10.3.
To make my issue easier to understand, I've put a zip of my project on my dropbox.
https://www.dropbox.com/s/xnrh90kuih9ia5a/SPARKY%202.zip?dl=0
Feel free to ask questions if I explained things to briefly and again, thanks to everyone who contributes here. I really learned allot after discovering these forums.
EDIT: Alright I booted up my windows machine, generated a visual studio environment and tried to build it on there. Seems that the same problem also happens here. I looked at the linker attributes/flags and saw a lib.lib file added to the linking process which doesn't look right at all.
When removing the file, the error disappeared and many others arrived! (Which are simply solved by linking the appropriate libs so I wont handle those here.)
I misunderstood the error on my mac and thought it was referring to a random library which I needed to hunt down but actually it's a inconsistency in one of my CMake files.
EDIT2: Now I only have to find out where the lib.lib comes from and how I can ditch the flags from the project so I can generate my environment and build right away!
So moral of the story. Sometimes the solution is right in front of you and still ends up more like looking for a needle in a haystack.
I removed the following from my root CMakeLists.txt file and the random lib.lib library was gone from my generated projects
SET( PROJ_LIBRARIES "lib" )
I thought this added a folder containing libraries but actually what it did was adding another flag for a specific library because this variable was being fed to:
TARGET_LINK_LIBRARIES( ${PROJ_NAME} ${PROJ_LIBRARIES} ${OPENGL_LIBRARIES} ${GLEW_LIBRARIES} )

How to compile this GitHub Project on Mac? No instructions

I'm really interested in an Arduino IDE project from GitHub, but since I'm a new programmer i don't have figured out how to compile those source files on my Mac. There is already ported to Mac as it shows on the version 0.6.0.0 changelog but i just does not know how to do it.
Can someone provide instructions for me?
GitHub link:https://github.com/aporto/mariamole
So as I'm sure you've noticed, that project is a vcxproj-- i.e visual studio. Compiling it on Mac would require some finagling. I don't have experience myself, but I found this in my queries for you
How to support both vcxproj to cmake on a project?
You're going to want to read up on a lot of resources to try to get a better understanding and maybe form a better google query. Alternatively the easiest route would just to get your hands on a windows machine to build this
Good luck!
You have two options:
1) There's already a cmake project included in the project file. It's used for compiling it at Linux
2) There's also a Qt .pro file, also included in the project files, that you can load at Qt Creator

Compiling Autotalent v2 Issues with Xcode 5.0.1 and Mavericks

I've been struggling to get Auto Talent from Oli Larkin to compile for some time now. I'm pretty new to Xcode and that may be the issue, but either way I figured I'd see if anyone could help me. I'm trying to compile this in order to make a 64 bit version.
Starting from the top:
I've traced down a few things that I thought were the issues.
Noticed that wdl sdk was missing. Downloaded it from https://github.com/olilarkin/wdl-ol. Added the wdl folder outside of the src folder.
Got some warnings when starting up Xcode 5.0.2. Let Xcode fix them.
Realized that the /Developer/Examples folder doesn't exist in Mavericks. Found https://developer.apple.com/library/mac/samplecode/CoreAudioUtilityClasses/Introduction/Intro.html#//apple_ref/doc/uid/DTS40012328-Intro-DontLinkElementID_2, downloaded the sample code, linked to AUBase as I realized this path needed updating in the AU Build Settings (see screenshot).
iPlug.xcodeproj is in red. Not sure what to do about this. Any ideas? I'm assuming it's important.
Update: Based on the recent comments, I'm now getting somewhere. But, at the moment I'm getting the following errors. This has to do with not having a Lice SDK or something. Is this absolutely needed? If so, do you have the time to elaborate on this and where to get it? Thanks again for all of the help.
It looks like I'm getting another issue as well related to clang. Maybe related to Xcode - Command /Developer/usr/bin/clang failed with exit code 1, not sure.
Note: Before finally getting to the errors above, I had to...
Link CoreMIDI.framework "Frameworks and Libraries" -> "Linked Frameworks" -> App to /System/Library/Frameworks/CoreMIDI.framework.
Set compiler in the build settings to default compiler. Otherwise it said unsupported compiler and threw some warnings. Hopefully this didn't mess anything up.
Rename aeffect.h and aeffectx.h to aeffect.h and aeffectx.h from the VST3 SDK. You can find these files in public.sdk -> source -> vst2.x. Apparently 2.x isn't really supported anymore. After renaming them, I moved them to the VST_SDK folder in WDL as the readme instructed.
the source you have will not compile straight off with recent versions of WDL-OL, since lots has changed. The way to upgrade it is to strip out the pertinent source code (i.e. autotalent.h/cpp and the mayer fft stuff) and re-duplicate one of the template projects in WDL-OL and bring it in to the new folder.
I've done it for you:
https://github.com/olilarkin/autotalent
you can clone this repository into the IPlugExamples folder of WDL-OL, and provided you've put all the SDK files in place it should compile straight off.
oli

Resources