Visual Studio (Visual Macro) doesn't include Arduino libraries - c

First, I'm sorry if it's not the proper place to ask this question. I'm not sure whether I should post it here or on Electronics Stack Exchange.
I use "Visual Micro" add-ons in Visual Studio 13 for Arduino. Normally, it works fine. But for my project I had to download these two library files, "Adafruit_SSD1306" and "Adafruit_GFX". Arduino IDE works fine but Visual Studio can't include them. It can't even include "Wire.h" but perfectly includes "SPI.h" header where both of them are in same directory. I included those files directories in project properties. But when I run "Build" it gives a fatal error:
And stops compilation. Same error occurs for the remaining two include files.
Can any one point out any mistakes I made, or suggest any way to solve this problem?
Thanks for your time.
Screenshot of project properties:

Actually I made a very silly mistake that most of the time is not worth to look for. This is just crap.
There is no space between "#include" and <Wire.h> and so the compiler is reading this as a whole sentence. If I write:
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
instead of
#include<Wire.h>
#include<Adafruit_GFX.h>
#include<Adafruit_SSD1306.h>
Then everything is fine.
How silly I am. -_-

Related

VS2019: Include file as project macro

I got a makefile project for Linux and I want to compile it on Win10 with Visual Studio 2019.
There are some paths to files defined in the makefile as preprocessor defines.
I have to replace the paths by own created files because they are a kind of PLATFORM_HEADER and I have to adapt a new one to Windows. In the code it looks like:
#include PLATFORM_HEADER
The onliest I tried is to add a property sheet to my project and add a macro:
macro page of property sheet But this macro is not found in the project.
Changing the code is not possible because it is third party code and it must be able to become updated at later times without doing changes again.
In other instructions there is noted that a line called 'inherited property sheet' has to be modified in the project. But in VS2019 this line does not exist.
Thank you for your help!
This sort of problem will be handled by your compiler suite. Probably you'll deal this with your build process manager (make, bitbake, cmake...). You can ask it to pass these #defines as argument for the compilation (-D name=definition).
Now you've unlocked the "very most of fun" if you compile something meant for linux on windows since there are many way that can go wrong. You might want to do a full check of your environment variable when compiling and make sure they point to the right system librairies.
Probably it's worth giving a try to the windows subsystem for linux and other bindings / emulator. If you want to preview a week of work's outcome, maybe you can do it in a linux VM? or just get rid of windows one good time for all :)

Visual Studio: Compiler now looking for pre-compiled headers after building ok for a week. I only have .c files

Compiler output.
Error 1 error C1010: unexpected end of file while looking for precompiled header. Did you forget to add '#include "stdafx.h"' to your source? C:\Users\Cathal\Documents\Visual Studio 2013\Projects\Go\Go\go.c 367 1 Go
Was working fine then all of a sudden the compiler starts asking for the precompiled headers which I turned off in the project properties.
ANSWER
I figured out that one of the projects (two projects in solution) had different configuration settings that was screwing the solution up. Can't mix and match of course. I wish VS would highlight this.
look up for all projects in the solution and check this

Include path issues in Eclipse: probably Indexer

While I was trying to compile a linux-kernel (v. 2.6.39) in Eclipse CDT, I have a not leaving problem about my include paths. I know this is a well discussed topic in the Internet, but all these solutions didn't fix my errors.
One of the errors is: **linux/kvm_host.h: No such file or directory**
one of the marked line in the source code is: #include < linux/kvm_host.h>
What I did (and actually expect to solve this problem):
In
Project Properties
C/C++ General
Paths and Symbols
I've added in "Includes", "Library Paths" the include directories:
e.g.:
- /[path-to-kernel]/linux-2.6.39/
- /[path-to-kernel]/linux-2.6.39/include
- /[path-to-kernel]/linux-2.6.39/include/linux
Still (after another make), it hasn't changed a thing.
So what's the matter, can someone give me a hint?
[Edit: As i mentioned in the comments, with STRG+Click on a underlined library it opens in my browser, so i believe it's just a problem of the Indexer but I think i have tryed everything in its options menu]
I just try to develop a fresh Linux kernel nothing special, I can't be the first one, doing this with a fresh eclipse.
After making a new project on the same kernel for the 3rd time it's working now. But still i don't have a clue why :/, since i rebuild the project an the indexer several times. I hope this won't be going on like this.
Thanks for your support!

Unable to start program, cannot find the file specified, Visual Studio 11

I'm working off of a fresh install of VS 11 Beta, on a Windows 7 64-bit machine. When I try to debug, it gives me this error message.
"Unable to start program 'C:\Users\myname\documents\Visual Studio 11\Projects\Project1\Debug\Project1.exe"
I'm almost entirely sure it isn't a problem with my code--it works fine on online compilers, making me think that it's an issue with how I'm saving it. Just in case, here it is.
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
printf("Hello, world!\n");
return 0;
}
My process for creating the project/file is to create a new empty Visual C++ project, then a .cpp file, write my code, save it as a .c inside of the first folder I'm prompted with, within the projects folder, and then try to debug.
What am I doing wrong, here? I know that the debug folder is empty, but I can't figure out how to create the .exe file that should reside in it.
NB: I'm rather new to programming. If answers could be phrased in babyspeak, that would be appreciated.
Well, there could be a number of things wrong. However, based on your description of making a ccp file and a c file, I'm betting that it's a problem in your VS 11 project rather than the code itself. My guess would be that either the c file didn't get included in your project (check the Solution Explorer) or that you have the main (or _tmain) function defined in both the cpp and the c files, which will make the linker issue an error.
There are a bunch of "Hello World" tutorials online for VS 2010 and earlier, but there don't seem to be many for VS 11 Beta yet. You may want to take a look at the 2010 versions. I found this video tutorial that you may want to check out.
Check the output directory. And you can also set manually an output direcotry to save the built exe file.
I know this problem was from May but I thought I would answer with a solution that worked for me:
I was creating a .cpp file in a blank project and was getting a similar error. I noticed that the file had a name but was not showing the extension .cpp. I added the extension to the file (ex3.18.cpp) and did not get the .exe error again.
I don't know if that makes sense with your issue but I worked on this for two days uninstalling and reinstalling VS 11, and this was what finally worked.

How do I debug existing C programs with Visual Studio 2010 Professional?

how can I use the Visual Studio Debugger on existing C programs I found in a textbook? I want to debug these little examples one by one, but without the overhead of creating a full project for each example.
Example: Let's say I compile "helloworld.c" from the Visual Studio command prompt ("cl.exe helloworld.c"). This gives me helloworld.obj and helloworld.exe. I would like to know if there is a way to use the VS debugger on "helloworld.exe". So far, I have only worked with the debugger on full-blown projects; I have no idea how to debug small "stand-alone" test programs without the Visual Studio project overhead. (I hope this is not a dumb question, as the VS Debugger might only be available for the full project.)
Thank you for any ideas.
Why don't you create one project for testing the sample codes? You can create a single .c-file for all the samples. This would look something like
void sampleA()
{
//hello world
}
void sampleB()
{
//hello everybody else
}
void main(int argc, char** argv)
{
// sampleA();
sampleB();
}
What I do when I have to use VS is to reuse the plain.c project I created a long time ago.
Just paste new code there and go. Throw the code in another file if you want to keep it.
If you're set on not using projects then you can do this. It just gets more difficult as the number of code files increases.
First, to do any meaningful source-level debugging, you will need to generate debug symbols. Add the "/Zi" switch to your cl.exe command line:
cl.exe /Zi helloworld.c
This will generate helloworld.exe, helloworld.obj, and helloworld.pdb (these are the debugging symbols).
Next you will open Visual Studio 2010. Use File -> Open -> File... and select helloworld.exe. It will generate a wrapping solution with one project for your EXE file.
In Solution Explorer, right click on the EXE file and select Debug -> Step Into new instance.
It should pop up a source window and show you the first line of your program. Now, debug away!
The debugger is part of Visual Studio, so you'll have to start it up anyway. However, for the debugger to work properly with your source code, you need to also generate a PDB file (see here). You get this by including /Zi or /ZI as argument to cl.exe (see here).
It is not impossible, but you'll have to learn a lot more about how to exactly build a program from the command line to get the best debugging experience. There are a bunch of options that are real time savers and greatly improve the odds that you'll discover bugs.
Which is a little beside the point right now, learn C instead of spending time learning a boring tool with way too many options. Creating a new project takes 5 seconds after a wee bit of practice. Use the Win32 Console Application project template.
One small setting you have to change if you want to compile as C instead of C++. Right-click the project, Properties, C/C++, Advanced, Compile As = Compile as C Code.
The "overhead" is hardly more effort that it took to post this question!
Simply start with the "Empty Project" template and add the single source file you wish to debug by right-clicking on the project browser sources folder. It takes mere seconds.

Resources