vscode(Visual Studio Code) + oF

#46

@guidoschmidt
Here is not doing the auto-complete for the OF methods… only the ‘pure’ c++ ones.
Intellisense is activated by default. I don’t know how to add /openFrameworks folder to a list or something.

Another annoying thing is that all addons are listed into the project, not only the used in the project.
I made the project with the @hrs PG from the zip in macOS Sierra 10.12.6.

The building process (on a big app with several addons) was also slow and stucked sometimes, or crash and must reopen the app… I had to compile in terminal with make.

My laptop here is not powerful, so in the meantime I think I will still using the not free AppCode, just to avoid the slowest Xcode.

#47

hmmmm… Seems like I have not implemented communication between frontend and commandline. (we need to call commandline PG with -t option). My PR looks only dropdown GUI like the title mentioned. I will check tmrw. In the meantime can you try Dropbox version or commandline PG?

Anyway, I will finish this work asap.
Thanks for bringing me back to this :slight_smile:

1 Like
#48

Got it all working in BTW. (love it!) Not to derail convo, but anyone who could answer this, I’d me most grateful:

1.) How do I reduce the verbose build and linking logs while build is happening? I’m seeling all warnings, etc. Just want errors…

2.) How do I reduce build time? Right now it seems to rebuild all addons and all code, every time!

#49

hey @stubbulon5, cool. did you got intellisense auto complete working whit OF methods too? Not working here in macOS by default. Here when compiling get stuck I compiled in terminal with make, and then back to VS Code. Then when compiling back in VS Code is faster, is not compiling all again… For me is a little messy to have all the OF add ons listed on the project, would be nice to have only the included on the projects. (I am using the compiled PG zip from the google drive link.)
EDIT: I get this maybe related notification error when opening a project:

C/C++ (Extension)
Failed to parse "/Documents/openFrameworks/addons/ofxImGui/example-multiwindow/.vscode/c_cpp_properties.json": Unexpected token ] in JSON at position 2255
#50

Hi @moebiussurfing. Yes my auto complete works for OF stuff. The error you are seeing is due to problem in your c_cpp_properties.json file, you must fix it.

You can verify if it’s a valid JSON document in a tool like : http://json.parser.online.fr/

Using the link above, it will highlight in black where your problem is.

#51

Cool! thanks @stubbulon5. :ok_hand:
it’s solved now.
I uninstalled and re downloaded VS Code again and now autocomplete with OF is working out of the box. I didn’t installed the suggested intellisense c++ extension for now just in case…
EDIT: I can confirm that when adding the extension it stops auto complete of OF stuff here, and says the json error. So I re installed clean without suggested extensions.

2 Likes
#52

it is running OK for you in both Debug and Release? I can only compile and run using Release option.

#53

I am not sure. Do not tested debug. I ended uninstalling VS and now back on AppCode 2019…

#54

re: Load and Save dialogs. Guys, I’m using Ubuntu, I discovered today that load and save dialogs dont appear when compiling with the Make / VSCode. After some debugging in ofSystemUtils.cpp, I discovered it’s due to compiler directive not being defined : OF_USING_GTK

Are we missing setting it anywhere? Ideas?

Thanks for any tips!

#55

vscode + oF is working great, thanks for all the effort @hrs
I’m trying it out again to test this plugin

Two suggestions:
now I can only run if I choose Release. Debug builds but doesn’t invoke built program.
And I have all addons listed on VSCode. it would be great to have listed only those in addons.make file
Cheers

#56

I remember I couldn’t automate starting debug process after run debug and end up just hit F5 mamually.

(To compile debug, you can select from command palette.)

Edit:
And yes, addon listing is next thing we can update.

Thank you for your feedback!

1 Like
#57

Guys, I know this is a bit of a fragmented thread, but for anyone looking to reduce / hide warnings when compiling, you can add

CXXFLAGS += -w

to the Makefile in your project, just before the compile.project.mk is included. ie:

This was in Ubuntu, but I think should work for other Env’s. If anyone knows of a better place to put this, please LMK!

1 Like
#58

PS. Really do appreciate the effort put in by the community (esp @hrs) to get this working. I simply cannot go back to QT Creator, the debugging in VSCode is so superior! And ONE project acrowss Mac, Win, Linux due to the flexibility of VSCode project files.

2 Likes
#60

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!

#61

Not sure but might be solved by using =

#62

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/*

#63

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.

#64

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
#65

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
#66

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.