C Code Interface: Object Names, Debugging, and Common Mistakes
The Importance of an Object Name in a C Code Project
After your project is built you can run it over and over. The project from that point, just like C, references every object in Vehicle Spy by name. So, if you change the name or delete an object in your Vehicle Spy setup that you use in a C project you will need to open Visual Studio and rebuild the project. This also means the C code projects can be reused across Vehicle Spy setups if you manage to keep the names the same for the objects you use.
![](https://docs.intrepidcs.com/~gitbook/image?url=https%3A%2F%2F2673726158-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FdYdvinhoJh0IN6rV8uo3%252Fuploads%252Fu15CjegmKm67T7mrlc51%252Fname_lookup_error.png%3Falt%3Dmedia%26token%3D23bf6640-69a7-4990-86c0-684bcd629998&width=768&dpr=4&quality=100&sign=1e5fcda6&sv=1)
Debugging Your C Code
Visual Studio supports debugging two ways. First, is it will launch Vehicle Spy every time you press run. Another allows you to connect to a running copy of Vehicle Spy (called attach to process) Vehicle Spy will allow you to build and connect to it when Vehicle Spy is not online. Therefore, the most productive way is attaching to an existing Vehicle Spy. Only Visual Studio standard edition or better supports attaching to an existing Vehicle Spy. You cannot build your project when Vehicle Spy has the C code loaded. Therefore, you must go offline in Vehicle Spy in order to fully build your project.
![](https://docs.intrepidcs.com/~gitbook/image?url=https%3A%2F%2F2673726158-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FdYdvinhoJh0IN6rV8uo3%252Fuploads%252FWbmwmTFPXtKBYSELNLf3%252Fattach_to_process.gif%3Falt%3Dmedia%26token%3Dc2861d82-a1e0-4969-b3da-a089884bf970&width=768&dpr=4&quality=100&sign=48dd59db&sv=1)
![](https://docs.intrepidcs.com/~gitbook/image?url=https%3A%2F%2F2673726158-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FdYdvinhoJh0IN6rV8uo3%252Fuploads%252F9a2f8rXQFmUrJgnDsXxm%252Fattach_to_process2.gif%3Falt%3Dmedia%26token%3Dbb6ea5d0-e05c-4d70-861a-8166a8a30193&width=768&dpr=4&quality=100&sign=345d73cb&sv=1)
![](https://docs.intrepidcs.com/~gitbook/image?url=https%3A%2F%2F2673726158-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FdYdvinhoJh0IN6rV8uo3%252Fuploads%252FB9DTwPeoa4V5a9URU9bo%252Fdebugger.png%3Falt%3Dmedia%26token%3Db2c130dd-7c7a-455d-9278-a7e63b867fed&width=768&dpr=4&quality=100&sign=6a6103fd&sv=1)
Common Mistakes for Building your project
1) You created an event function, but did not implement it in SpyCCode.c. This causes a linker error. Make sure to copy the C function from the Event Code tab in the edit dialog for the C code module.
![](https://docs.intrepidcs.com/~gitbook/image?url=https%3A%2F%2F2673726158-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FdYdvinhoJh0IN6rV8uo3%252Fuploads%252Fbzy9FKxs29yPTMx27Zr1%252Ftroubleshooting_linkererror.gif%3Falt%3Dmedia%26token%3Dba5d6cd9-b18f-4ec6-b289-91dee0f75f38&width=768&dpr=4&quality=100&sign=737f36c6&sv=1)
2) You try to build the project while Vehicle Spy is online. The project is loaded. Go Offline in Vehicle Spy and then build the project.
![](https://docs.intrepidcs.com/~gitbook/image?url=https%3A%2F%2F2673726158-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FdYdvinhoJh0IN6rV8uo3%252Fuploads%252F9Mz5GyrCNnHrs9tXZl7P%252Ftroubleshooting_loaded.gif%3Falt%3Dmedia%26token%3Db5510ee7-6fd0-4990-9c1d-eb489d9cf80a&width=768&dpr=4&quality=100&sign=acbb6f09&sv=1)
Last updated