Hello everybody,
About Unix: The '$' token is actually the '&' token, and it is used to run an application in the background, using the current console. The application still has a console, and will die when the console dies.
For a project my dad has enlisted me in, I am to be able to communicate with a Vitamin Scanner from a computer. To illustrate, he opened 'Hyper Terminal' (should come with most Windows computers). He set up a communication using the program, and told me the baudrate, stop bits, parity, etc.
So I set about making this program. I decided to use C++. After researching for like a week or so, I stumbled upon some code that by all means, should work. I have attached the code in a file attachment, along with a few header files that are important.
I am using Visual C++ 2008 Express Edition. I use Windows XP. When I try to compile, it says it can't find the header file 'stdafx.h'. Does anybody know where I can download it, and its associated files? Or, if there is no way to download it, does anybody know of a better way for Serial Communication in windows?
- 3 Contributors
- forum 4 Replies
- 364 Views
- 1 Day Discussion Span
- commentLatest Postby bobbuilder67Latest Post
jonsca1,059
Start a new project in VC++ this time uncheck precompiled headers and leave empty project unchecked. Add your files to the project by right clicking on the solution/Add.. etc. and you can clear out all the other files (or just exclude them from the project to be safe). You've probably done everything correctly except for the precompiled headers part.
but if I wanted to use that #include 'stdafx.h' inside my 'Empty' project, it doesn't works... |
What Is #include Stdafx.h In C++
Of course not. stdafx is the precompiled header. If you don't have a precompiled header, then how can you include it?May I know how to solve this problem in 'Empty Project'?? |
It's not really a problem. Just don't include that header.
Or if you must (if you have dozens of files and you don't want to modify them all), you can 'fake' it by creating a blank file named 'stdafx.h'.
Can I know what is #include 'stdafx.h' for? |
When you #include a header file, it's sort of like copy/pasting that header file into the cpp file. The compiler will walk through, examine, and compile that header whenever you compile the cpp file.
The compiler will do this process for every cpp file that includes that header. So if you have 100 cpp files in your project and they all include the same header, that header is being compiled 100 times.
If the header is very large, this might cause the computer to take a long time to compile your program. So compilers give you an option to 'precompile' a header so that it compiles only once. Then each cpp file that #includes it does not have to re-compile it every time, they can just use the precompiled version. It can speed up compile time.
MSVS likes to name the default precompiled header 'stdafx.h'. But that's all it is.
It's worth noting that precompiled headers are completely worthless