Question: I am trying to get the autocomplete Google MAP API working. However, whenever I load the page I get an error 'Uncaught ReferenceError: google is not defined'

HTML 

```
<label>Location</label>
<input id="location_field" type="text" class="form-control" placeholder="Location">

```

JAVASCRIPT

```
let locationField = document.getElementById('location_field');
let autocomplete = new google.maps.places.Autocomplete(locationField);
google.maps.event.addListener(autocomplete, 'place_changed', function () {
     let place = autocomplete.getPlace();
     specifiedLocationObject = place;
});

```

I always get the error on this lin :

```
let autocomplete = new google.maps.places.Autocomplete(locationField);

```

Answer: 
You need to generate compile\_commands.json and put that in your vscode work directory. This file will tell vscode linter where to look. This needs to be regenerated if you create new files or your compile instruction in CMakeLists.txt changes (i.e new libraries)

I made a [youtube video](https://youtu.be/b9vXhlJllsE) to demo this

I also answered this in a similar post on a reddit: [Has anyone got Visual Studio to work properly with ROS?](https://www.reddit.com/r/ROS/comments/hqud2a/has_anyone_got_visual_studio_to_work_properly/). I've added the answer i wrote for that below;

If you use catkin\_make, when you compile,

`cakin_make -DCMAKE_EXPORT_COMPILE_COMMANDS=1`

A `compile_commands.json` will then appear in your build folder after compiling.

If you use catkin tools, because the build system is different, you will have a run a script after building to merge the individual `compile_commands.json` into one

[See the issue here for script.](https://github.com/catkin/catkin_tools/issues/551)

You can then restart VScode, and it will prompt you and ask if you want to use it when it starts. If it didnt prompt you for whatever reason,

> 
> [In the "Advanced" section of the Configuration UI, you can supply the path to your compile\_commands.json and the extension will use the compilation information listed in that file to configure IntelliSense.](https://code.visualstudio.com/docs/cpp/faq-cpp#_how-do-i-get-intellisense-to-work-correctly)
> 
> 
> 

Basically, the steps are:

1. cakin\_make -DCMAKE\_EXPORT\_COMPILE\_COMMANDS=1
2. move compile\_commands from catkin\_ws/build under your vscode work directory, i usually have it under catkin\_ws/src, personal preference
3. Point vscode to your compile commands.

ROS should work properly from here.

Edit: added steps from answer made in another post
In the file `.vscode/c_cpp_properties.json` (generated by the [VSCode ROS extension](https://marketplace.visualstudio.com/items?itemName=ms-iot.vscode-ros#review-details)), try to change from `"cppStandard": "gnu++14"` to `"cppStandard": "c++14"`.

ROS is using the [c++14 standard](https://www.ros.org/reps/rep-0003.html#melodic), so specifying `gnu++14` seems to break things. This was deduced from [this question](https://answers.ros.org/question/341313/what-happens-if-i-use-c-17-features-in-my-ros-nodes/).

An [issue](https://github.com/ms-iot/vscode-ros/issues/336) exists about this.