vscode(Visual Studio Code) + oF

Hi @hrs,

I’m having issues setting preprocessor definitions / compiler directives.

The make command seems to be ignoring them. Any ideas?!

and JSON equivalent:

(EDIT: I have ediited my config.make file) PROJECT_DEFINES= section to make it work for now, but I thought the point was to use the c_cpp_properies.json file

Any help appreciated!

Not sure but might be solved by using =

Hey @hrs
Thanks for the contribution, I have been looking into this for implementing this on windows, and I was going down the msys2 route, but I have been having some trouble with this

I looked into the config and I saw that you went with the visual studio version of the make for the windows build rather than the msys2 make version.
Do you think that would be better rather than the complications of adding in msys2 or hmm?
C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/include/*

Hello,

Are you maybe trying my repo “vscode_oF”?
It seems c_cpp_properties.json is outdated. ( sorry I will update asap -> EDIT: done)

Instead of that repo, please refer to vscode files in openFrameworks master.

You can see the setting for mingw like below.

I tried this setting with latest commandline PG right now and it still compiles/runs without problems. (Windows 10 and latest oF master, latest PG)

However vscode Windows template is not very well tested on my side since I’m using VS2017 in most of case. Please send PR if you find a better configuration.

This morning, new updates for vscode and template feature is merged into oF & PG master repo. Now we can generate&update vscode project via frontend PG. (Thanks arturo!)

So far I tested under,

  • macOS High Sierra
  • Windows 10, mingw
  • Linux Ubuntu 16.4

Since I can not conduct all tests for all platforms + OS combination, it would be great if you could try on your environment.

How to test?

  1. checkout latest master, both of oF and PG
  2. execute download script, etc.
  3. check if you can compile example project with make command.
  4. compile commandline PG
  5. compile frontend PG
  6. Run PG frontend and turn on advanced mode
  7. Select vscode from template dropdown.

Please follow official document how to compile PG.

It would be nice to start testing in this month in order to provide ideas (and bugs) to coming oF conference in October.

2 Likes

great. I’ve tried now updating only the command line and I get the following error

/Volumes/tool/openFrameworks/apps/projectGenerator/ofxProjectGenerator/src/addons/ofAddon.cpp:12:10: 
'Poco/String.h' file not found

I think your system can not find Poco. Have you run install_dependency.sh? Or download_lib.sh?

If you are on Linux, you might need apothecary update poco.

im just trying the nightly builds of oF to use vscode on macOS.
I can say it starts fine & can make a vscode project. it asks for the c/c++ intelligence package & I have installed it but have not done anything else.

is there any other steps to getting set up? I have tried a simple f5 to run things after the package install, but it does say that there is not a debug application. so just asking for extra pointers in getting this to work

thanks again for all the work you have put into this

ah wait… I may have something I did forget :wink:

well… on that thing I tried, which was the Run Build Task - I can do f5 to some degree. it does do something bu does crash it seems. these are the screenshots of what happened once doing a run of things with f5

Hi!

This is so great, I would like to edit the plist to display in high resolution mode however each time I build the plist reverts back without my edits.

Hi, PG only copy files when you hit update or generate button. So your issue is not related to PG. It might be related to the build script of Xcode project.

Thank you! I’m not using the PG, just editing the plist from VS code. However it may be a little over my head.

Thanks for sharing this!
I Can compile and Run / Debug any project in VS code for Ubuntu.
Though, to get intelisense working with everything inside addons, I’m needing to manually list paths to some subfolders inside the c_cpp_properties.json files.
e.g.:
“${workspaceRoot}/…/…/…/addons/ofxGui/src”,
“${workspaceRoot}/…/…/…/addons/ofxOpenCv/src”,
“${workspaceRoot}/…/…/…/addons/ofxOpenC/libs/opencv/include/opencv”

I’m wondering if anyone knows a way to automate this process

Hello,
We still don’t have this feature in PG.
You can check PG commandline project, must be not so complicated.

Hiroshi

I dont know whether anyone has ran into this. but im getting the same problem over & over again & dont know what to do

Someone can help me putting Intellisense to work again?

I’m in VSCode and after installing PlatformIO IDE plugin it messed my openFrameworks-VScode setup.

Some errors were shown about lost headers… cairo.h and some other stuffs when I try debug build something… After some googling, I remove all VSCode from Osx (10.13.6) . After new install I was able to build and run stuffs, but I can’t put IntelliSense to work again…

I have installed C/C++ 0.27.0 VSC plugin from MS and C++ IntelliSense 0.2.2. (like @lewislepton videoTutorial)

Macbook Pro 8,1
OSx 10.13.6 High Sierra
OF 0_11_0

Once I had a similar issue and solved by deleting and re-generating vscode’s database. The location of database file depends on your setting which is specified by this line.

https://github.com/openframeworks/openFrameworks/blob/c2e3a9b078b5bf26a18f6a2abcdbc0dceb5a80b1/scripts/templates/vscode/.vscode/c_cpp_properties.json#L40

But I noticed this line is only for macOS. “databaseFilename” setting for Windows and Linux is empty. If you are on Windows or Linux, it must be somewhere app default location.

Thanks @hrs for response…! :slight_smile:

I tried to delete browse.db in .vscode directory, it has created another browse.db but intellisense autocomplete doesn’t work yet.

How can I provide additional info to solve this issue?

Can you upload your vscode setting files to gist or somewhere?

Is possible to get code completion working for addons and custom classes? Now seems to work only on oF