Welcome, Guest. Please Login or Register
Arduino IDE for Visual Studio
 
 
When Logging a Support Issue in the Forum, please ensure you have also:-
  • Enabled vMicro > Compiler > Show Build Properties and Verbose
  • Re-Compile your program with these settings enabled
 
Save the new Output to a Text File and....
Support requests without the output above may be impossible to answer, so please help us to help you
 
  HomeSearch Tutorials & Wiki visualmicro.com LoginHelpRegister  
 
Page Index Toggle Pages: 1
Send Topic Print
'not declared' and 'incomplete type' errors (Read 3062 times)
mi
Newbies
*
Offline



Posts: 6
'not declared' and 'incomplete type' errors
Aug 17th, 2016 at 12:29am
 
Hello

I have an issue adopting an existing working project into Atmel Studio 7 with Visual Micro.

I have a lot of 'not declared' and 'incomplete type' errors upon compilation.

The project structure is something like this:

arduino_folder\my_project\my_project.ino
arduino_folder\my_project\another_file_1.ino
arduino_folder\my_project\another_file_2.ino
arduino_folder\libraries\arduino_library_1\arduino_library_1.h
arduino_folder\libraries\arduino_library_1\arduino_library_1.cpp
arduino_folder\libraries\arduino_library_2\arduino_library_2.h
arduino_folder\libraries\arduino_library_2\arduino_library_2.cpp

The errors arise within a set of libraries (individual classes in this case) I wrote myself in C++ where a class lib references another lib class, e.g. class referenced within arduino_library_1.h references the class type within arduino_library_2.h.

I have tried:
*adding "class prototype;" in header files,
*adding "#include xxx" to both .h and .cpp files
*explicitly adding each library subfolder as a -I option in the project properties
*different combinations of the above

Unfortunately nothing results in correct linking of the files.

I suspect that it is something to do with the #ifndef/#define single inclusions I have within the headers, but as mentioned before this was working before in Arduino IDE, and also I see from the blurb at the bottom of this Visual Micro page, it should operate in a similar manner:

http://www.visualmicro.com/page/Arduino-for-Atmel-Studio.aspx

Quote:
All required libraries must be #included in the project_name.ino, regardless of their use only in .cpp sources. All library #includes will be linked regardless of preprocessor #conditions. This is historically how Arduino has worked and also applies to Visual Micro for Visual Studio 2010.


So my theory is that '#conditions' are in fact taken into account meaning my #ifndef/#define single inclusions are somehow breaking the compilation.

Any ideas?
Back to top
« Last Edit: Aug 17th, 2016 at 12:32am by mi »  
 
IP Logged
 
mi
Newbies
*
Offline



Posts: 6
Re: 'not declared' and 'incomplete type' errors
Reply #1 - Aug 17th, 2016 at 10:10pm
 
OK I found the issue with this

Firstly, the compiler is ignoring the case sensitive file name of the #include

Secondly, the project settings have shuffled the order of include search directories and so it was incorrectly giving priority to another unrelated file (filename with same letters but different case!!) over my own.

Thirdly, Atmel Studio has to be fully restarted to get it working. Clean+build is not enough.

Back to top
« Last Edit: Aug 17th, 2016 at 10:11pm by mi »  
 
IP Logged
 
Visual Micro
Administrator
*****
Offline



Posts: 10464
United Kingdom
Re: 'not declared' and 'incomplete type' errors
Reply #2 - Aug 18th, 2016 at 9:36pm
 
Thanks for the update. I was a little confused as to "what working previously means" and the arduino ide has only recently started to support code in sub folders.

Arduino since 1.6.6 has a new avr/gcc compiler but many other factors could affect things.

You should try to see the difference with vMicro>Compiler>Deep Search switched off. This is a new auto detection system released in arduino 1.6.6 which find #includes in cpp files instead of relying on declaration in the .ino files. Deep search also applies #conditional rules to which #includes will be valid. Older arduino versions worked the way visual micro works if you switch off "deep search". The arduino ide doesn't provide the option to switch it off.

If I recall visual micro with pro license will support a \libraries folder below each project, however normally, for visual micro pro users" project libraries are placed in [project folder]\src\micro-api\libraries

I have never known the arduino ide to support local project libraries however I expect they will support them sometime soon. Let me know of you see them supporting that.

Arduino include paths are never set in stone and not documented. They mainly rely on the order the operating system returns library folders during scan. There are not any published rules about the order that local project code folder are compiled. So any order should never be relied on. The only known order is that the files in the project are sorted into

To avoid confusion it is always useful to switch on vMicro>Compiler>Verbose and also the "show build properties" option. Then build and attach the output as a .txt or email to info[at]visualmicro.com. The verbose output gives a full account of what is being compiled and the result of each compilation which gives the info required to solve or explain most issues.

Hope that helps although I admit without verbose output it's hard to fully understand the issue (and possibly even with verbose output Smiley )
Back to top
« Last Edit: Aug 18th, 2016 at 9:37pm by Visual Micro »  
WWW  
IP Logged
 
mi
Newbies
*
Offline



Posts: 6
Re: 'not declared' and 'incomplete type' errors
Reply #3 - Aug 29th, 2016 at 2:55am
 
Well the problem still stands.

It seems the issue I solved earlier I solved actually by *temporarily renaming HttpClient(.h,.cpp) in:
C:\Program Files (x86)\Arduino\libraries\Bridge\src
(it was not being used by anything)

*I say temporary but I completely forgot about it and it became permanent Smiley

So the above three things I mentioned in previous reply are not completely true. However it is still ignoring the case sensitivity of the #include file which should picking HTTPClient.h in my designated /library folder, and not HttpClient.h in the folder above.

I have since upgraded Arduino from 1.6.9 to 1.6.11 and the problem returned because HttpClient.h was restored. And so it is back to complaining that my (completely different) class members are not defined.

When I try with Deep Search switched off as you suggest I get errors such as "fatal error: internetConnection.h: No such file or directory" which is in my designated /libraries folder.

Visual Micro wrote on Aug 18th, 2016 at 9:36pm:
I have never known the arduino ide to support local project libraries however I expect they will support them sometime soon. Let me know of you see them supporting that.


It seems local project libraries are supported properly with Arduino 1.6.11, though I have not yet tested it:
https://www.arduino.cc/en/Main/ReleaseNotes
Back to top
 
 
IP Logged
 
Visual Micro
Administrator
*****
Offline



Posts: 10464
United Kingdom
Re: 'not declared' and 'incomplete type' errors
Reply #4 - Aug 29th, 2016 at 5:03am
 
What is the name of the library folder that contains the correct httpclient?

Back to top
 
WWW  
IP Logged
 
Page Index Toggle Pages: 1
Send Topic Print