I tried looking up my question using the search engine first but the few
results I found pertained to programming situations far more advanced than my
simple undertaking. I had some experience with programming in college but that
was about a decade ago. I just recently downloaded the Dev C++ and am trying
to work through program exercises from a book "The Elements of
Computing Systems". Currently I am building a pseudo-assembler for the virtual
machine and I have one class in my program called Parser that I have got up
and running. I now would like to add a second class to this short program that
I have written but when I tried to recompile I get error messages like
"invalid use of undefined type 'class foo' " and "forward declaration of class
foo" and "ISO C++ forbids declaration of 'Public' with no type" etc. I went
back and tried to add an even simpler class that did nothing but print "Hello"
but got the same response. I do not think this is a result of a typographical
error in the program; when I comment out the added code the program will still
compile and run successfully. I don't want to trouble you good folks with my
trivial problems but this has got me stumped so if anyone has a suggestion it
would be greatly appreciated.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
You wrote a huge amount in your combustion; unfortunately almost all of it was
useless in terms of helping you solve your problems.
It is quite simple; if you get compiler errors, your code is invalid - simple
as that. If you get linker errors, you have not provide all of the necessary
code to the linker.
Beyond that, there is no helping you from the information you have provided.
You need to post the compile log (all of it), and the code (or at least a
small example that reproduces the error); you also need to tell us the Dev-C++
version. Note that all this is clearly stated in the
thread.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
a few suggestions:
1. follow the basic three in posting question.
2. the compile log helps alot.
3. use paragraphs if you decide to skip 1 & 2 above. getting to know you is great, but hunting for facts in a large paragraph is not great.
with the little you did provide, i would concentrate on the last error
messege. your class may not be set-up properly, therefore it may be the reason
for the first two error messages. generally, i fix the first error message
first. i move on to the other errors afterwards. you may have a correct class
syntax wise, but inheritance wise it may be wrong.
by inheritance wise i mean things like:
1. forward declarations needed by the class.
2. ADM classes that dont do anything except provide a common starting point.
2b. virtual functions throughout "the inheritance path".
3. multiple inheritance from two classes.
happy hunting
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Ok I think I have figured out what I was doing wrong, or rather, what I was
failing to do.
Apparently I was not saving my work to disc after every change I made in the
code. Now, If I change so much as a dot or a tittle, I save the project before
attempting another build. Seems obvious I know, but some things have to be
learned the hard way.
Maybe this post can act as a legacy for other dummies like myself.
Cheers.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
What could you be doing! In the default configuration at least, all project
and source file changes are automatically committed when you build. You should
not have to do that manually. Check the editor options for your installation.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I tried looking up my question using the search engine first but the few
results I found pertained to programming situations far more advanced than my
simple undertaking. I had some experience with programming in college but that
was about a decade ago. I just recently downloaded the Dev C++ and am trying
to work through program exercises from a book "The Elements of
Computing Systems". Currently I am building a pseudo-assembler for the virtual
machine and I have one class in my program called Parser that I have got up
and running. I now would like to add a second class to this short program that
I have written but when I tried to recompile I get error messages like
"invalid use of undefined type 'class foo' " and "forward declaration of class
foo" and "ISO C++ forbids declaration of 'Public' with no type" etc. I went
back and tried to add an even simpler class that did nothing but print "Hello"
but got the same response. I do not think this is a result of a typographical
error in the program; when I comment out the added code the program will still
compile and run successfully. I don't want to trouble you good folks with my
trivial problems but this has got me stumped so if anyone has a suggestion it
would be greatly appreciated.
You wrote a huge amount in your combustion; unfortunately almost all of it was
useless in terms of helping you solve your problems.
It is quite simple; if you get compiler errors, your code is invalid - simple
as that. If you get linker errors, you have not provide all of the necessary
code to the linker.
Beyond that, there is no helping you from the information you have provided.
You need to post the compile log (all of it), and the code (or at least a
small example that reproduces the error); you also need to tell us the Dev-C++
version. Note that all this is clearly stated in the
thread.
a few suggestions:
1. follow the basic three in posting question.
2. the compile log helps alot.
3. use paragraphs if you decide to skip 1 & 2 above. getting to know you is great, but hunting for facts in a large paragraph is not great.
with the little you did provide, i would concentrate on the last error
messege. your class may not be set-up properly, therefore it may be the reason
for the first two error messages. generally, i fix the first error message
first. i move on to the other errors afterwards. you may have a correct class
syntax wise, but inheritance wise it may be wrong.
by inheritance wise i mean things like:
1. forward declarations needed by the class.
2. ADM classes that dont do anything except provide a common starting point.
2b. virtual functions throughout "the inheritance path".
3. multiple inheritance from two classes.
happy hunting
Ok I think I have figured out what I was doing wrong, or rather, what I was
failing to do.
Apparently I was not saving my work to disc after every change I made in the
code. Now, If I change so much as a dot or a tittle, I save the project before
attempting another build. Seems obvious I know, but some things have to be
learned the hard way.
Maybe this post can act as a legacy for other dummies like myself.
Cheers.
What could you be doing! In the default configuration at least, all project
and source file changes are automatically committed when you build. You should
not have to do that manually. Check the editor options for your installation.