![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 | |
|
Newbie
Join Date: Jun 2005
Posts: 7
Rep Power: 0
![]() |
Compiling Error with Dev-C++
I am having a problem with my program compiling using the Dev-C++ compiler. I have never had this problem before today.
For some reason, my program will not compile; here is the code that I am using. [PHP]#include <stdio.h> main() { int count; count=0; while(count<100){ ++count; printf("Count = %d\n",count);} printf("The final count is %d\n",count); scanf(" "); } [/PHP] I have used that same exact coding from another program I made, and have had no problem with it. I know its the same, because I copied it directly from the other program. I am able to compile and run the old program just fine; but I am not able to compile my new program. I can save the source file, but not compile it. When I try to compile it, I get the following error: Quote:
Thanks in advance. |
|
|
|
|
|
|
#2 |
|
Expert Programmer
Join Date: Dec 2004
Posts: 794
Rep Power: 4
![]() |
that isn't PHP, don't post it in PHP tags. use code tags.
|
|
|
|
|
|
#3 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
Look at the makefile and see that the proper location of the file is specified. As to the PHP tags, they are not reserved for PHP code. Many use them in order to get the syntax highlighting. It's a matter of personal preference.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
|
#4 |
|
Expert Programmer
Join Date: Dec 2004
Posts: 794
Rep Power: 4
![]() |
and I, personally, hate it.
|
|
|
|
|
|
#5 |
|
Newbie
Join Date: Jun 2005
Posts: 7
Rep Power: 0
![]() |
I'm sorry if this is a noobish kind of question; but how would I check the makefile to see if it's targeting the correct location?
|
|
|
|
|
|
#6 |
|
Programmer
Join Date: Jun 2005
Location: Maryland, USA
Posts: 59
Rep Power: 4
![]() |
If you are using the IDE to code, compile and run the program, your makefile should be managed for you automagically. You can try starting off with a brand new project and copy/paste your code in that project and see if that helps.
A niggling thing, but main is generally expected to return an int, zero on success, non-zero on failure.
__________________
Free code: http://sol-biotech.com/code/. It is not that old programmers are any smarter or code better, it is just that they have made the same stupid mistake so many times that it is second nature to fix it. --Mitakeet The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man. --George Bernard Shaw |
|
|
|
|
|
#7 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
@uman: You are entitled to hate the syntax highlighting provided by using PHP tags and entitled, as well, to express that opinion. If it is other than a personal opinion, such as a technical requirement or a forum policy, please say so. Bald statements to newbies that are unfounded, thus introducing unnecessary confusion, aren't a wise approach.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
|
#8 |
|
Programming Guru
![]() ![]() ![]() |
This works fine for me:
#include <stdio.h>
int main (void)
{
int count;
count=0;
while(count<100)
{
++count;
printf("Count = %d\n",count);
}
printf("The final count is %d\n",count);
scanf(" ");
return 0;
}
__________________
http://jasonpowers.net "There are a thousand hacking at the branches of evil to one who is striking at the root." |
|
|
|
|
|
#9 |
|
Programming Guru
![]() ![]() ![]() |
btw... may want to line up your { and } in your various blocks to avoid potential for confusion.
__________________
http://jasonpowers.net "There are a thousand hacking at the branches of evil to one who is striking at the root." |
|
|
|
|
|
#10 |
|
Programmer
Join Date: May 2005
Location: England
Posts: 61
Rep Power: 4
![]() |
Those blocks are aligned horribly. It makes it really annoying to read. You should really adopt a method of indentation and stick to it. Normally, I go for something like this:
while(condition)
{
statement();
switch(variable)
{
case 1:
more();
statements();
break;
default:
default();
case();
break;
}
}But it's entirely up to personal preference.
__________________
http://www.nuticulus.net/hackmysig/sig.PNG Give my site a chance, you know you want to ;-) Google will solve 99% of your problems. Including those with your sex life. Caution, may <strike>contain</strike> be nuts. |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|