|
akayoku wrote:
As I have copied some functions in here, but still have no idea on how to make it compilable.
And what does your code look like?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
I don't know why. After I have donwloaded the code and included all header file, it always has a compile error which states:
fatal error C1083: Cannot open include file: 'stdafx.h': No such file or directory
Error executing cl.exe.
What is the matter with "stdafx.h"? Indeed, I can't see this header file in the directory, but even if I copy the "stdafx.h" into the directory, it still can't work. It would just pop up even more errors like:
Cannot open include file: 'afxwin.h': No such file or directory
Error executing cl.exe.
Suddenly, more and more header files are needed. Would anyone tell me what to do?
|
|
|
|
|
akayoku wrote:
fatal error C1083: Cannot open include file: 'stdafx.h': No such file or directory
Error executing cl.exe.
Your code does not use precompiled headers, but the code you're imported does. Just remove the include for this file in the code you've added.
akayoku wrote:
Cannot open include file: 'afxwin.h': No such file or directory
Error executing cl.exe.
These headers are included by stdafx.h. Just remove the include for stdafx.h ( or check to see if your project is set up to use precompiled headers, in which case, change it ).
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Yes, I did try to remove that line of code. However, it turned out to ahve several more errors in the program.
- error C2146: syntax error : missing ';' before identifier 'REGSAM'
- fatal error C1004: unexpected end of file found
Error executing cl.exe.
It seemed that after removing that, it missed something in the program which leads to undeclared things or functions.
Landy
|
|
|
|
|
akayoku wrote:
fatal error C1004: unexpected end of file found
This usually means that your project uses precompiled headers, and some of your files don't include stdafx.h. The easiest thing is to go to your project settings, and set precompiled headers to be automatic, and set stdafx.h to be the file. I think automatic is the one, it means it will use them if the file includes them.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
In the project setting, choose the "Automatic use of precompiled header"
and then under the "Through Header:", I have tried to type in the stdafx.h , with or without quotation, and the .h
But, the error still exists.
fatal error C1083: Cannot open include file: 'stdafx.h': No such file or directory
Error executing cl.exe.
Registry.obj - 1 error(s), 0 warning(s)
Landy !_!
|
|
|
|
|
Well, if you have code that includes stdafx.h, then you need to have the file there. And if you import the file, then you need to either make sure that everything it includes is visible, or you need to change it.
It's really hard to guess exactly what's going on. What's the nature of your project ( is it windows/console ? What frameworks does it use ? ) and how did you import this other code into it ?
The core issue is probably that it's clear you shouldn't be importing other people's code, you should spend some time learning how everything works first.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Thanks for your opinion.
I have tried to find a suitable stdafx.h file, but there are too many on the web and in the help directory of VC, all are different and I dont know which to use.
I am now actually working on a project about security. The program gets the MAC Address from the computer. Then, I am going to check if the MAC Address just obtained is the same as the default MAC address. Therefore I need to extract a string from the Windows Registry. That's why I need to know how to get a string in there and now I am stuck here ^^...
I do not understand what you said about windows or console and framework. But, then I understand I should not import other's codes. I am trying to learn from the code and see what I can do.
~~~~~ Landy
|
|
|
|
|
akayoku wrote:
I have tried to find a suitable stdafx.h file, but there are too many on the web and in the help directory of VC, all are different and I dont know which to use.
OK - you can't just rip files from other projects willy nilly and insert them, especially stdafx.h, as it will differ from project to project.
akayoku wrote:
I do not understand what you said about windows or console and framework
I'm not being rude, but you're writing security code but you're experience is such that you don't know what a console application is ? A console app is one that brings up a console window ( one with just text in it ). A windows app has a window. You need to abandon this until you have a better idea of some basics, or you risk never learning them.
akayoku wrote:
But, then I understand I should not import other's codes. I am trying to learn from the code and see what I can do.
If you were to look inside the registry classes you've got, then you should see the code you need in order to read and write the registry.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
At this point it would be better if you started over. Use AppWizard (Ctrl+N) to create a new application. A Win32 Console Application would probably be best to start with. On the "Step 1 of 1" box, select the second radio button (you don't need to mess with MFC right now). Now in the main() function, you can access the registry using RegOpenKeyEx() and RegQueryValueEx() . Use printf() to print out the results. See if you can get this working and then we can help you build upon it.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
akayoku wrote:
But, the error still exists.
you can also Use CRegKey Class defined in ATLBASE.h
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
But, I do not have ATLBASE.h
Where can I have it?
|
|
|
|
|
What version of the compiler are you using ? You probably should have it.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I am using VC++ 6.0
Yes, I can find the atlbase.h , but after inserting it as the header file, it always keeps saying that :
fatal error C1083: Cannot open include file: 'atlbase.h': No such file or directory<br />
Error executing cl.exe.
Sigh.... wondering Landy
|
|
|
|
|
Again, the basic problem is that you're trying to walk before you can crawl. I recommend buying a book on basic C++, and also doing a range of simpler projects before trying to write anything so complex as to access the registry.
In order to use a header that's not in your project directory, you need to set the include paths for either the IDE ( so it always works ) or for the one project, to point to the folder where the file is. Or you need to specify the full path to the file in your #include statement.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Yes, really, I am trying my best to walk before I learn to crawl. My professor only gave me a month to study it and now working hard on this project. I have read some basic things in fundamental references.
Anyway, when the program stated that it can't find the header file in the directory, I find the header file for it... I have tried to find out all the header files it needs, however, after all, other kinds of errors pop up finally like: syntax error, or undeclared identifier, etc...
~~~ Landy
|
|
|
|
|
akayoku wrote:
te :47 24 Jun '05
Yes, really, I am trying my best to walk before I learn to crawl.
Can't be done.
akayoku wrote:
My professor only gave me a month to study it and now working hard on this project.
Then your professor is not being fair. Complain.
akayoku wrote:
I have tried to find out all the header files it needs, however, after all, other kinds of errors pop up finally like: syntax error, or undeclared identifier, etc...
When you include a header, it can include more. That's one reason you can't just use any stdafx.h. I'm with David, it sounds like you've made enough of a mess that the only way forward is to create a new project and start again.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
how are you including the atlbase.h file :
#include "atlbase.h"
or
#include<atlbase.h>
anyway, second one in correct
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
I have tried both.
When I tried the first one, it would turn out many errors like syntax errors, undeclared identifier, etc...
When I tried the second one, it still states that atlbase.h is still missing in the directory.
~~~ Landy
|
|
|
|
|
akayoku wrote:
When I tried the first one, it would turn out many errors like syntax errors, undeclared identifier, etc...
Check Is you find the ATLBASE.h at this location
DRIVE NAME:\Microsoft Visual Studio\VC98\ATL\Include
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
|
now include you ATLBASE.h using absolute path i.e.
#include " DRIVE NAME:\Microsoft Visual Studio\VC98\ATL\Include\atlbase.h"
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
I have tried it, but:
fatal error C1083: Cannot open include file: 'C:\Microsoft Visual Studio\VC98\ATL\Include\atlbase.h': No such file or directory<br />
Error executing cl.exe.
I have also tried to copy the file into the same directory as the program, then it started to ask for another header file called "atldef.h"...
After I added "atldef.h", then it asked for another, and then another....
In the program, if I type #include <atlbase.h> , it just treats it as absent; if I type #include "atlbase.h" , then it would ask for other header files.
After copying all header files it needs, finally it pops up other general errors: syntax or undeclared stuff....
~~~ Landy
|
|
|
|
|
Are you sure it's not:
DRIVE NAME:\Program Files\Microsoft Visual Studio\VC98\ATL\Include
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
I am having problems with a combobox that has a datasource. I am trying to set the selected item after the comobobox has been created
an example of my code is
DataRow* row;
row = playerDataSet1->Player->get_Rows()->get_Item(index);
myComboBox->set_SelectedValue(row->get_Item(:PlayerID));
this works perfectly when I run with the debugger, but as soon as I run without the debugger it doesnt seem to work
Any ideas of how to fix this would be appreciated
Thanks
Randy
|
|
|
|