Visual Studio not showing errors

Started by
5 comments, last by Shaarigan 3 years, 7 months ago

I am using Visual Studio mainly for programming in C/C++ and at the moment I am messing around with devkitpro (has compilers and more for many nintendo systems) to programm games for the GBA. Because the GBA-compiler needs its own folder structure I don't want to create a whole Visual Studio project but rather just open and edit the single files within VS.

However if I open a .c/.h/.cpp file directly the red underlines for errors within the code don't show up and the error-window doesn't show errors either.

I looked into tools → options → Text Editor → C/C++ → advanced if the corresponding settings are correct and they are. Nothing is deactivated everything is as usual.

Any ideas how to toggle on errors for single files?

Advertisement

I don't think thats really possible. Visual Studio uses its project-file environment to determine where to look for include-files, what type of compilation the file uses, etc… . If you have a visual-studio solution, you can configure those parameters on a per-file basis, but without a project-file I don't see any way of giving visual studio this information, and as such it seems that it will not do much of its Intelli-sense work (basic auto-completion seems to still work but no error-checking as you've encountered. But even if it would, it would just mark everything that is not part of the core-c++ syntax or part of a std-header as read as it won't be able to see the other headers likely).

A pity. But maybe I can somehow "integrate" the required folder structure for the GBA compiler somehow into a visual studio project. I think that should be possible.

Thank you

Without a vcproj or sln file, your code will be parsed as text files (or xml if they are or else ….).

So yes add them into a proj files to get intellisense to kick in and get some error reporting then u can compile in gbac.

While you're at it, after you have created the proj file, you could try and configure gba compiler as a custom build in devstudio:

right-click on the project→properties (select configuration/platform)→configuration properties→custom build step… try and enter the a batch file containing details of your build instructions ('make' + etc…)
I'm aware that it is not straight-forward but it could be far better than Programmer's Notepad++ 2, right ?

That's it… all the best ?

I think adding all the stuff to VS should be fairly simple. Mostly you just need to get the C/C++ → General → Additional Include Directories at the project level to have it looking in the right place for headers.

But it does also need to manage to successful parse the headers, so will have to see how well it manages.

You might also need to adjust the C/C++ → Preprocessor → Preprcessor Definitions to emulate what your actual build scripts will use as well depending on what sort of #if checks the headers do.

There is a small chance of finding something that VS just can't understand and breaks it parsing the header file e.g. if there is any extended attribute type stuff like the MSVC __declspec or GCC __attribute__ like `int var __attribute__((aligned(16)));`, which you would need to work around. Possibly you could do well enough by adding some preprocessor defines to just strip such things out.

EDIT:

Infact quick search seems to indicate you basically do use the GCC compiler for GBA? In which case any of the IDEs for GCC might have better out of the box support. Also if the “folder structure” is just coming from a make script or such, you probably do have some freedom there.

Visual Studio can be configured using any folder structure regardless how it looks like by adding all the files to the .vcproj file and in addition add a .vcproj.filter file. Here you can configure all your files to look nicely and even be addressed in “virtual folders”. We use this in our build tool because we also don't have traditional folder structure for our projects but organize everything in modules that may be spread across the project and our SDK

This topic is closed to new replies.

Advertisement