C++/CX error C3699: '^' : cannot use this indirection on type 'int'

by billkrat 19. May 2013 01:48

This is a Microsoft Bug 785188, from their response it most likely won’t be fixed anytime soon (or at all).   So yes, according to the IDE there are no issues with the following code – that is until you attempt to compile.

I now recognize this error for what it is, I failed to define IContainer.   I recognize it because “cannot use this indirection of type ‘int’” is a red herring, I also know that when I see this that the “missing ‘;’ before identifier will highlight the culprit so this one can be quickly tucked under your belt as an experience/training topic; when you, or someone on your team, sees this you can quickly rectify it. 

Screenshot

With the following highlighted definitions both the IDE and Compiler are now happy.

AllIsWell

C++/CX Chaining functions are a C# thing…

by billkrat 18. May 2013 15:46

We C# developers are so spoiled….

Learning C++ from a C# developers perspective continues to be challenging, particularly with the IDE/compiler idiosyncrasies.   After a good head-banging session performing TDD on the SqliteConnection class it felt good to move on to the next unit test.   Imagine my jaw-dropping surprise when my very first SQL command fails during sqlite3_execute(), particularly since I assmeme’d (I always spell that wrong) that I had a valid _sqlCommand (reference line 82 below) based on the fact that I had successfully used ConvertCxStringToChar() in other areas, i.e., the SqliteConnection class that I just completed TDD on.

So down the rabbit hole I went again and as I debugged the code I found an odd behavior that I had not seen yet; for some reason my sqlCommand on line 79 was being garbled upon return from the ConvertCxStringToChar method.   The C# developer in me couldn’t see immediately what separated this from other uses of this method because we (C# developers) freely chain multiple commands without consequence; as a matter of fact because of Linq we chain quite a bit.   After careful comparison I found the only real difference was I was chaining .c_str() on line 79 but not in my other processes.   I removed the statement and all was well ???

To make sure that this is what the issue was I added lines 82 and 83 after removing .c_str() from line 79 and the results confirmed my surprise (was not even a suspicion).  

DaisyChainHeadBanger1

Tags:

Cpp

C++/CX SQLite “unable to open database file”

by BillKrat 18. May 2013 11:12

That was five hours of my life that I’ll never get back….

I started TDD on my ADO.NET like framework for SQLite, unfortunately I was blocked on my very first task of opening the database – I was getting an “unable to open database file”. 

If you are anxious to get back to work the quick answer is to ensure that SQLite is processing the database in your local folder (reference highlighted lines 26 and 27 in second pane below).  After fixing... the code below passes first unit test which asserts that the passed in connection string is the same whether setting it internally using constructor or externally using the property.  It also verifies that the conn->Status == “Open” after line 33 in the third pane of figure 1.  

It is important to know that “CreateFile2 is for accessing your app’s local data storage locations.  Libraries can only be accessed via WinRTAri Polsky, 2011/09/22 (read more).  I think it is a safe assumption that SQLite is using CreateFile2 based on code (ref figure 2). 

FinalCode
Figure 1 TDD on SqliteConnection class

The hard part was figuring out the cause of this generic SQLite message.  After downloading the source code for SQLite and stepping through the sqlite3_open() method I found there were actually two errors being generated.   The first was the real problem “access denied” and the second was a result of the first “The system cannot find the file specified” – reference images 2 and 3 respectively.  

ErrorSource
Figure 2 first error message

ErrorSource2
Figure 3 second error message

These errors were eventually masked and replaced with the generic message we’ll see (ref figure 4)

ErrorSource3

What led me down this rabbit hole was the following blog entry (figure 4), it is either outdated or misinformed, unfortunately I started out on a bad path because of it.  I thought perhaps it had something to do with the CreateFileAsync method creating the file but when I manually plugged in the path and bypassed async processing I got the same error.   It was here that I realized I needed to abort this trail, get out of the hole, and continue researching…

Misfortune
Figure 4 falling into the rabbit hole…

 

static String^ ConvertCharToCxString(string stringToConvert)
{
    wstring wcharStr = ConvertStringToWString(stringToConvert);
    auto cxStr = ref new String(wcharStr.c_str());
    return cxStr;
}

// Get location of local folder and append filename (connection) to it
auto folder = ApplicationData::Current->LocalFolder;
auto filePath = ConvertCxStringToChar(folder->Path) + "\\" + fileName;

rc = sqlite3_open(filePath.c_str(), &db);

C++/CX WinRt and Windows Phone code sharing

by BillKrat 12. May 2013 06:08

Before EHR certification requirements made the development of EHR applications cost prohibitive, I wrote an EHR program for a medical group. It started as a web application which soon opened up a requirement for a desktop application (the Internet was not available at all locations visited by the doctors).  Within a short period of time the requirement for mobile application soon arose.  Within one year I was maintaining three applications.

The doctors wanted each application to perform identically and had a hard time understanding why I had to bill them for each application when only one set of changes were required; the problem was that each application had a separate code base.  This prompted my journey to create a single code base for all platforms which I had just completed with my open source password manager application (link below), but then C++/CX was released and it was time to start over….

SOURCE: http://PasswordMgr.CodePlex.com  Change set: 102777

With the preliminary infrastructure started, and unit test in place, it was time to “share” the completed source code with a Windows Phone project.  I was surprised that the Windows Phone project was a C# project and that I was expected to add references to a C++ Windows Runtime Component (WRC) project (versus being 100% native).   We know the saying that “beggars can’t be choosey”, so I’ll take what is available but it almost makes me feel that C++/CX is not the first class citizen all the Build conference hype made it out to be….  It is still early in the game (I hope)… <ends frustrated rant after falling for the hype and abandoning C# for Windows 8 development>  

I created my C++ Phone WRC project GwnLibraryPhone and proceeded to COPY/PASTE the files from the GwnLibrary (a Windows Store App C++ WRC project).   When I got done I reviewed the file locations and had expected results since I copy/pasted from Visual Studio filtersonly the GwnLibrary project folder have files, the GwnLibraryPhone folder has no files and the project points to the GwnLibrary files.

NoFilesWhenShared
Figure 1 sharing source code (single code base)

Since templates are not supported by the C++/CX Application Binary Interface (ABI), my templated methods such as Resolve and Register had to be in an external project; I share C++/ C X templates with other projects.  The GwnLibraryInclude WRC project contains all of the C++/CX shared components which are unusable in my C# Windows Phone application.  I had to create a GwnLibraryPhoneInclude project which has a C# extension class with generic methods to match its C++/CX counterpart.   This extension class allows me to use the same source for both of the C# and C++/CX applications (ref figures 2 and 3 below).

Code
Figure 2 Utilizing C++/CX classes in a Windows Phone application

RegisterResolve
Figure 3 C++ templates and their C# counterparts

Note: The Visual Studio compiler will complain if the namespace does not match the project name so I have to have the following preprocessor directives on all of my classes:

#if PHONE
namespace GwnLibraryPhone {
#else
namespace GwnLibrary {
#endif


Preprocessor

How to migrate your Winforms application to WPF

by billkrat 27. April 2013 07:43

Are you looking to migrate your WinForms application to WPF?  This will most likely be a major refactoring task that will result in parallel programming (which always leads to synchronization issues as you upgrade the current product to meet production requirements).   On the list will be bringing in contract developers experienced in WPF, but in most cases (like myself) we don’t have the domain knowledge that the in-house developers will have; you would be better served making that investment in your own developers.

My experience with standing up a new application (while maintaining an existing one) is the process puts a strain on the entire operation/system as you go through the stages of development, QA, and release into production; every department will feel the strain.

There is a solution where you can leverage your in-house talent while taking an agile approach permitting you to move forward in a single direction – ultimately, in the end, achieving your conversion SUCCESSFULLY. 

First and foremost, the investment has to be made in refactoring, one way or another this is going to happen.  If however you first start by refactoring “your existing application, on your existing platform” you have the benefit of hindsight (we all look back at our own code thinking – I could have done that better), experience, and understanding of current systems.   The key is to take an agile approach using architectural patterns that will lend towards reuse, extensibility, and scalability.   One such pattern is MvpVm.

MVP-VM a pattern that transcends platforms (allowing you to reuse application logic across them)

First and foremost: The fastest ramp-up to any application, framework, or process is to understand the architectural patterns.  If your team understands the  MvpVm pattern they will know that there will be no code in the view’s code-behind or on its view model (they will know what a view model is).  They will also know to look for the Presenter(s) as this is where the code will be.   How it got there can be learned at their convenience but to ramp-up, and get the job done, they only need to go to the Presenter.   It is important to understand Dependency Injection, aka IOC (Inversion Of Control) as most enterprise applications designed for reuse will be dependent on it.   With these topics under the belts of your developers you will well be on your way – with (so far) a little to no investment.

Where to start? A great starting point (where I would start if my next contract took me into a WinForm shop looking to migrate to WPF) is the open source project “Baldur’s Gate Party Gold Editor – WPF, Windows Forms MVP-VM sample” on CodePlex (click here).  

Side note: when you think of the Factory or Command patterns do you think of WinForms, WPF, or ASP.NET?   None of the above right? Because these patterns are not platform specific.  The same holds true for the MvpVm pattern as the architect Deniz İrgin so effectively teaches us in the above referenced project.

Below is a screen shot of his SelectSaveFolderPresenter, without knowing how he bootstraps the WinForm and WPF applications I know where to go to find the code (shared project PartyGoldEditor.Core) because I recognize the patterns.  IMPORTANT NOTE: without understanding the patterns the “typical” developer will open up the WPF and Winform applications and find “NO” code in the three view’s code-behind and be totally lost – it will appear as Voodoo; I speak from experience the first time I downloaded my first Prism drop (read more)

The KEY POINT HERE is that he is reusing the same source code for both WinForms and WPF.   What this means is that your agile roadmap, and refactor of your application, can be done in WinForms while preparing it for WPF.

Overview

My recommendation would be to designate “a” person to develop the new framework (perhaps using all of Deniz’s code as a framework), this person should be someone who understands the referenced project and is excited about it (there is much to be excited about here).   Be sure to have the person develop high level diagrams that will let other developers understand how it bootstraps (starts up). 

You will find that once your framework is in place that little to no time is invested in it – 95% of your developers time will be spent focusing on business requirements.   The referenced framework lends to Test Driven Development (Deniz has plenty of unit test) which also means that View’s can truly be left to a View designer (who doesn’t have to necessarily be a developer); this designer could be that contract WPF developer or better yet an in-house developer who is excited about learning WPF (there is plenty to be excited about there also).

With the framework is in place your developers can have a design discussion as to what module/component should be refactored first; all of the existing business logic can be migrated into the new framework components (by your experienced in-house developers who understand the engine under the hood).   Likewise the refactored application can be moved forward into the existing process, which QA and deployment teams are already comfortable with, for all essential purposes there will be no visible evidence your solution is turning into a WPF application.

If you hold true to Deniz’s design you could refactor your entire application – IN WINFORMS – and then when all of the work is done, has been tested through QA, and successfully deployed to production, you can start working on your WPF view’s.  

In the end you will have a well-built, decoupled, reusable, extensible application – at a fraction of the cost, using your own in-house talent, that will be easier to work on.  

C# apps – abstraction over composition

by billkrat 27. April 2013 03:44

Last month I did a blog on composition over abstraction (click here to read); this is more about making lemonade (working with what I got) then a preferred pattern at least to this C# developer.   With C++/CX your classes have to be sealed unless then derive from an existing unsealed class, currently the recommended class to use is the UI framework’s DependencyObject.  Not my first choice for creating a baseclass for a business or data access layer (and it has issues) but once again – I’ll make lemonade.   This is not to say that there was not a lot of truth to what I wrote – the key is to find the balance of composition AND abstraction, fortunately C# developers have this choice.

So why do we C# developers love our inheritance?   Because it simplifies our code and prevents us from having to do copy/paste development.   Take for example our C# VS2010 demo application that accompanies this blog, below I click on the [Woof] button and it reveals content relevant to a dog; each button represents an animal.

Source code: http://www.global-webnet.com/blogfiles/InheritanceExample.zip

App
Figure 1

All of the animals have something in common, a name, color, leg count, and they make a sound.   An animal for these attributes could be described by the following class (note that the Initialize method will initialize my base to common values).   The Speak() method results will be displayed to the status bar upon button clicks.

AnimalBase
Figure 2

The AnimalBase has an IAnimal interface which looks as follows:

IAnimal
Figure 3

This is not to say that we are confined to just these properties, perhaps our Cat and Dog have additional properties that are not common to either (or any) animal.   For example our Dog class will want to have a means to designate its best friend as well as provide a message (reference figure 1 and below).

ParentInterfaces
Figure 4

Because of inheritance we can easily create our AnimalDog class by simply deriving from AnimalBase; effectively giving us access to all of its properties and methods without us having to duplicate them in our AnimalDog class. 

To initialize my dog class I simply have to set the properties for the attributes required for my usage, in this case a black dog that barks and has a best friend of man.   When I ask this class to speak it reveals this information (reference figure 1 status bar).

 AnimalDog
Figure 5

What if we want to override what the animal says when it speaks?   This is our case for our AnimalCat as shown below where we wanted to add more information to our status bar:

AnimalCatApp
Figure 6.

Below our AnimalCat class “overrides” the Speak() method (below lines 30-35).   In order to do this the baseclass has to support it, in our case (figure 2 line 61) we define Speak as a “virtual” method, this tells the application that this code can be overridden.

Since we want the original message (we simply want to append to it) we call the base.Speak() method on line 32 below.   We then append the additional information our cat class provides.  Note that we initialize our cat values as applicable for our business requirements.

AnimalCat
Figure 7

In the case of our Cow and Pig (image below) we’ll reap the greatest benefits of inheritance as we only have a couple of things that differ for our purposes – so the code for each of those classes only have Initialize methods:

AnimalCowPig
Figure 8

Since this is a MvpVm application our business logic will reside in the MainPresenter (see folder MvpVm in figure 8 above (you won’t find business logic in code-behind or view models – this promotes reuse) .   Below we show the MainView which also resides in this folder.

How it works? In a nutshell, all of our buttons of our main menu will be bound to the “ButtonCommand” (XAML line 20 of image below) of our MainViewModel (shown in figure 9), they each send a CommandParameter (line 22) of “self” which effectively provides the ButtonCommand an instance of the button clicked.   We then add all of our buttons (lines 26 through 30).

The Presenter instantiates the View (line 21) and the ViewModel (line 22) and then wires up the ButtonCommand – when the button is clicked it will be handled by the code between lines 28 and 43. 

When a button is clicked line 31 will remove the “btn” from the name, i.e., BtnCat will become “Cat”.   This is passed into the factory on line 37 (reference figure 10 for AnimalFactory code) and a concrete instance of animal is returned, i.e., an instance of AnimalCat would be returned.  

The instance returned from the factory is inserted (line 41 right panel) into the XAML contentControl (line 34 left panel).  We then update the ViewModel.StatusBarMessage with the instance Speak() results.

We effectively stuffed a instance of a class into a XAML content control, this is where the power of XAML shines because the first thing it will do is check to see if there is a DataTemplate for layout instructions.  In this case there is because we updated our App.xaml page to point to our Resources/EntityTemplate.xaml resource dictionary (reference figure 11).   Before we move our discussion to figure 11 make a note that our Presenter on line 45 below (right panel) handles button clicks for any button that binds to AnimalCommand.   Let’s jump to figure 11 now (below).

XamlPresenter
Figure 8

ViewModel 
Figure 9

Note that the factory will call the Initialize() method on the applicable class (effectively setting its values) and then will replace the .Name property of the class with the key value, i.e., “Cat”, “Dog”, etc.

Factory
Figure 10

Because we pushed our instance into a ContentControl that instance now becomes its DataContext.  For this example we’ll assume the [Woof] button was clicked and we are looking at an AnimalDog instance (lines 22-40).

We display the Name value and have the MyBestFriend value in a TextBox.   The Button binds to AnimalCommand (to handle it’s button clicks) but note we have to do something extra; because we changed the DataContext to the instance, and our AnimalCommand (which we want to bind to) resides on the ViewModel, we have to tell the Command to go to the MainView and use its DataContext.AnimalCommand for binding - we do this via the RelativeSource attribute.

When the Button is clicked, the Presenter (figure 8 line 46) will be passed in a reference of the button clicked (because of the CommandParameter binding) which can then be interrogated to see if it implements ICat or IDog and if so will go to its respective process.   In the example of IDog we handle the button click and update the Message property of AnimalDog as applicable.

IMPORTANT NOTE:  Where you don’t have to code to interfaces (you could just as easily code to AnimalBase or specific implementation such as AnimalDog this does hamper the power of the Factory pattern, i.e., if I wanted to add a AnimalBullDog that implements IDog then all I would have to do is create the class, update my Factory (above) and add the data template below – no plumbing would have to be updated.

DataTemplates 
Figure 11

Where AnimalCat and AnimalDog will use its defined data templates above, any undefined instances (such as AnimalPig, AnimalCow, and AnimalBase) will default to the “AnimalBase” template.  If an instance cannot find itself in a data template then only the classes full namespace is shown as a string.

C++/CX warning C4172: returning address of local variable

by BillKrat 25. April 2013 20:23
Book I’m chomping at the bit to get Bjarne’s new book on C++ (it is preordered)…  When I encounter errors such as “warning C4172: returning address of local variable” it would be great to understand (under the hood) what this really means.   In the meantime….
At a high level, based on my Bing research (here), I understand that any variables declared in a function are destroyed upon leaving the method so if you are returning a reference to one of these variables you’ll get the above compiler error – what the blogs/forums fail to do is provide a comprehensive solution.   This is particularly problematic learning C++ from a C# developers perspective since we don’t have to worry about such trivial things as returning a value – we simply return it.

Source code: http://PasswordMgr.CodePlex.com change set: 102593

ConversionCode

The above is what I pieced together from my collective research (answers not provided on any single site) and below is how I consumed the above functions.

I’ve reached a point in my framework development where I have to start persisting data, this is where I start getting my feet wet in modern C++11 as I am using Sqlite – a C++ library.   Since my framework is based on C++/CX, I have data conversion requirements – I’ll have to do the following:

  • Convert String^ to char*  (line 19 below)
  • Convert char* to wchar_t* (line 25 above)
  • Convert wchar_t* to String^ (line 30 below)

On line 37 above we see that C++/CX String constructor excepts a wchar_t* which makes our life easy for this conversion, the only thing is that sqlite3 functions work with char* which isn’t a direct conversion to String.

Starting with line 19 below we have to turn the String^ ConnectionString property to a char* value so that we can provide it to sqlite3_open as its connStr parameter (line 22).   This is where I got the C4172 warning starting this adventure….  I found that declaring a type as static in a function would be a quick easy fix – when the function loses scope and the memory is reclaimed the static variable will reside safely in the global heap which we will have a pointer to, but this comes with its own issues.  The preferred pattern was to allocate memory via malloc (lines 20 and 29 above) – the only constraint with this was that we have the responsibility of manually freeing up this memory when we are done with it (lines 38 above and 23 below).

So on line 19 below I perform my conversion, on line 22 use the results, and on 23 clean up house.   A wee bit more coding then I’m accustomed to as a C# developer but I’m encapsulating this logic into a reusable class (with the promise of power and performance) so I’m happy with the trade-off.

The next challenge came when my unit test failed, sure I could step through it and see the error returned by sqlite3_errmsg(db) on line 27 below but in the real world, the production world, this is not acceptable – I need to know right away so I plugged in my IOC container and class base which provides a logger (line 28 below).    The Logger is a C++/CX component (so I can navigate around the Application Binary Interface (ABI) with ease) which means I have to convert the char* returned by sqlite3_errmsg(db) into a String^ first. 

With the above method I can easily perform the conversion in one step (not having to worry about freeing up the memory since it is encapsulated with in the function on line 38 above).   The result is a developer friendly reason for the failure.

Note: since I use an IOC container my ILogger interface could easily have its implementation of DebugLogger replaced with a SqlLogger which would permit me to view logs within a development, QA, or production environment.
TDD

Note that I resolve my SqliteConnection using my IOC container, this effectively propagates the dependency chain so that I can use Dependency Injection within this class.  This provides me a logger via the registered implementation for ILogger.  

I’m following the ADO.NET pattern so that when my Sqlite framework is completed I can refer developers to existing ADO.NET documentation to learn how to use it (removing the overhead of having to document proprietary code).  Likewise I’ll be creating SQL implementation so that either SQL or Sqlite can be used.  

C++/CX – simplify programming with “Code Snippets”

by billkrat 21. April 2013 02:31

One of the first mental sighs I expressed while learning C++ from a C# developers perspective came as a result of all of the typing I was having to do; my thoughts were “great, it takes twice the code to generate a class”.  Since then I’ve learned to appreciate the power/simplicity of “code snippets”.  Now I create properties for C++/CX as fast, if not faster, than I do with C#.  To appreciate what I’m suggesting click on the following image to watch a short video clip that shows how quickly (and with so little typing) I was able to generate the following property code (with comments):

VideoScreenshot

A code snippet is an xml file (see below) that hooks into intellisense permitting you to create a template for writing code.   To access the snippet manager first click on Tools and then select “Code Snippet Manager”, you will be greeted with the following screen:

Manager

I first selected“Visual C++” from the dropdown and then clicked on “Visual C++” so that I could get the file path (Location) to existing code snippets so that I could copy/paste an example.   I then created “_Snippets” folder in my PasswordMgr::GwnLibrary project and renamed the snippet to cxaprimpl.snippet (for C++/CX (a to sort to top) Property Implementation.   Now when I type “cx” my code snippet appears in the list (ref image below) – if I hit <tab> at this point it will automagically insert code for me.

Intellisense

Notice below (image right bottom pane line 34) that I have “template” code inserted with my template parameters  highlighted.   If I click <tab> it will cycle through each of the highlighted template parameters, i.e., type, property, class, backing field.   For the sake of discussion I will focus on the “type” template parameter highlighted in the XML code below.

The <Literal> elements identify the template parameters to use, we specify a CDATA block and within this block put our templated code.   We delimit our template parameters with dollar signs to let Visual Studio (VS) know these are parameters.   The <Default> element lets VS know what to use as a default value, for example below my “type” template parameter will default to String^ (ref line 34 of bottom right pane).   If I type a new value it will be substituted for all instances of $type$ within my templated code.

The only typing I need to is for each of the templated fields, when I hit <enter> all values (i.e., String^ on lines 34, 35, 36, 44, 52, and 57 will be replaced with the value I type on line 34, likewise for the other template parameters as I tab into each highlighted fields and replace its value.

xmlSnippeta

I then strategically place code in locations that will simplify the coding process, i.e., I place the $type$ _$backingField$ last so that I can easily copy/paste it into the private: segment of the class (usually right below it).

C++/CX: SQLite.WinRT.props was not found / Setting up SQLite for WinRt

by BillKrat 20. April 2013 10:35

Source Code: http://PasswordMgr.Codeplex.com

Microsoft Bug: https://connect.microsoft.com/VisualStudio/feedback/details/785192/

Configuring SQLite for use by C++/CX Windows Runtime Components (WRC) is relatively easy using Visual Studio’s “Extensions and Update” feature, however it does come with a drawback.   If a developer using your solution does not have the Sqlite extension installed they will be greated with a “load failed” on the applicable projects, i.e., for my Password Manager solution my GwnDataSqlite project simply showed a “load failed” after I got latest on my HP TouchSmart development box (I primarily develop on my Samsung Slate).   The only clue I received to why was a message box I received when I attempted to reload the project, this message assumes a lot on the developer as it trust that they will know that the SQLite.WinRT.props is part of an extension.   Ideally the project should load but provide a compile error giving the following information with, as a minimum, a hint that it could be missing an extension.

ErrorLoadingProject

Setting up SQLite using Visual Studio’s “Extension and Updates” feature

 

First click on Tools and then “Extensions and Updates”

ExtensionMenu 

Select “Online” and search for “sqlite”, install the SQLite for Windows Runtime extension.

Extension

Once installed select the applicable project(s), right click, and select “References…”

ProjectMenu

Select the Windows and then Extensions options (in the left bottom treeview) and select “SQLite for Windows Runtime”

WindowsExtension

When you click OK you should see the following:

 ProjectPropertyPages

Behind the scenes your project will have been updated, more specifically the VC++ Directories “Include Directories” property to include the following: $(FrameworkSDKRoot)\..\V8.0\ExtensionsSDKs\(see below for remaining)

Note the “\..\V8.0” underlined in red, this tells the compiler to back out of the v8.0A folder (also underlined) and to then switch into the V8.0 folder – where the remaining path resides. 

ProjectPropertyPagesv1

When I first complied with the steps (to add SQLite) the include on line 3 had failed; it could not be found.   I suspect exiting the solution and reentering cleared this up because when I exited the solution to verify the header existed in the specified folder (hierarchy) and reloaded the solution the following <sqlite3.h> header file was found without issue.

IncludeSqlite3

C++/CX overloaded function differs only by return type from 'int *

by BillKrat 20. April 2013 07:02

Microsoft Bug: http://connect.microsoft.com/VisualStudio/Feedback/details/785188

Microsoft Bug 785188

Developing C++ from a C# developers perspective is less challenging as I learn the nuances of the Visual Studio IDE.  The following is an example of where I would lose much time chasing my tail for what I now deem a bug in visual studio – a bug because as far as the compiler is concerned the SqliteReader, although declared (using statement on line 3 below), has not been defined.   Based on my experience with the C++ compiler I’m finding that undefined components default to int* as is the case for SliteReader^ on line 17.

Exception

The only change that I made was to add a using statement on line 7, this effectively defines the SqliteReader for the compiler which resolves our compiler error.  

Builds