Check all compile errors - vba

I have inherited a fairly large vba program that was built without Option Explicit turned on.
I've added this to the code and am working through the compile errors (Debug > Compile ...)
All issues I've come across so far are variables that are not declared
Compile error:
Variable not defined
My issue is that the compiler only displays one error at at time.
Is there a way to display all compile errors in a single view?

Related

Compiling KratosMultiphysics with All Applications get errors

I am compiling Kratos with this standard-configure.sh that I modify:
standard-configure.sh
But I get error and I can't compile Trilinos maybe I wrongly put the TRILINOS_ROOT.
If anyone can point me which place should I place TRILINOS_ROOT and METIS_INCLUDE_DIR as well.
Not only that, there are other errors when compiling (see attachment below), how to get pass this?

Run dbt without compiling

Is it possible to do a dbt run with the already compiled code without the compilation being run again?
I have a project that takes a lot to compile and the running time is quite low, and I have to run it 1000s of times.
The partial-parse flag is what you're looking for.
The answer is not entirely correct.
Partial parsing does not prevent compilation - it simply prevents parsing of unchanged files. Models are compiled anyway, and you can check this by placing a "run_query" call in any model and compiling with partial parse many times. You still get better times, but compilation is unavoidable.

Does modern IDE compile source code instantly and continueously?

Modern IDE such as Visual Studio and Android Studio can highlight syntax errors, spot out typos in variable and method names, highlight the variables that are not declared etc.
So are these IDE compile the source code instantly and continueously? If yes, why the actual compile process is often much slower than highlighting errors?
Visual Studio doesn't compile when it spots syntactic and semantic/logical errors, but it can detect these errors by performing the "lexical analysis" and "syntactical analysis" steps of compiling code that other IDEs might take while compiling without compiling because it has a built-in functionality for that. When you click "Build", that's when the source code is compiled. Compiling takes longer because because the compiler does not only go about indicating errors, but also converts your source code into assembly language and then machine code (complicated process whose speed depends on many factors). Also, the compiler sets aside memory on the heap and call stack. These processes force the compilation phase to take longer than just pointing out errors.

Ambiguous "User-defined type not defined" Error

Generally, when the "User-defined type not defined" error occurs, a piece of code within the project is brought up on the VB6 UI and highlighted to show the user which user-defined type the IDE is unable to make an associate with.
In my case, however, no frame/code is popping up for this error, leaving me no idea which user-defined type this atrocious piece of software is unable to find.
This project is huge and includes hundreds of different references and components. Project -> References shows nothing is "missing". Any ideas for how to find out what user-defined type the IDE is unable to find?
Try setting project compatibility on every project in the group and start the application with Ctrl+F5 in the IDE.
Try compiling from command line -- check out vb6.exe /? for more info.

Why no error in VB.NET

I have recently switched from a c# team to a vb.net team. One of the things I have not been able to find an answer to is the differences in compile error / options. Let me explain.
In C# i will, using default settings, get a compile time error when trying to pass in an invalid type to a templated class like below. Here I create an Animal with a string type and afterwards I pass in a datetime which results in an compile error.
IAnimal<string> animal = new Animal<string>();
animal.SetTrainer(DateTime.Now);
I know I will get the same compile time error in vb.net with "Option Strict". There is, however, a lot of legacy (VB) code in the same file that will not compile with "Option Strict". What options do I have. Im thinking this:
Switch to "Option Strict" and fix all errors. Will take some time and may break working code.
Maybe there is an alternate that will ensure compile time check of generics. After all generics are rather new so maybe there is a way of always enforcing this.
?
Thanks in advance
Double click your Project -> My Project.
Goto Compile and look for Warningconfiguration
Now you can change some settings.
Implicit cast
Late Binding
don't make them errors but warnings.
That won't make compile time errors but you can at least see some warnings.
Another solution would be to make your class a partial class and move your code to a new file. You can set Option Strict / Option Explicit on a per file basis.
Switch to "Option Strict" and fix all errors. Will take some time and may break working code.
Yes, do that. It will help you remain sanity.
Most errors that will pop up are probably simple casting issues, which are easy to fix (a CInt here, a ToString() there...).
You don't have to fix your whole solution or project at once, since you can enable Option Strict On at file level. Make it a good habbit to fix every file as you have to touch it.
This will not always be possibly, but you can also just move code that heavily relies on Option Strict On (e.g. COM stuff) to another file without breaking changes.