Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Jun 4th, 2005, 5:29 PM   #1
MrSpecial
Newbie
 
Join Date: Jun 2005
Posts: 7
Rep Power: 0 MrSpecial is on a distinguished road
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:
The system cannot find the file specified
I have tryed saving the source file quite a few times. I am not sure if I am saving it incorrectly, or what. Does anyone know how this problem can be fixed?

Thanks in advance.
MrSpecial is offline   Reply With Quote
Old Jun 4th, 2005, 5:41 PM   #2
uman
Expert Programmer
 
Join Date: Dec 2004
Posts: 794
Rep Power: 4 uman is on a distinguished road
that isn't PHP, don't post it in PHP tags. use code tags.
uman is offline   Reply With Quote
Old Jun 4th, 2005, 5:50 PM   #3
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
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
DaWei is offline   Reply With Quote
Old Jun 4th, 2005, 6:14 PM   #4
uman
Expert Programmer
 
Join Date: Dec 2004
Posts: 794
Rep Power: 4 uman is on a distinguished road
and I, personally, hate it.
uman is offline   Reply With Quote
Old Jun 4th, 2005, 7:11 PM   #5
MrSpecial
Newbie
 
Join Date: Jun 2005
Posts: 7
Rep Power: 0 MrSpecial is on a distinguished road
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?
MrSpecial is offline   Reply With Quote
Old Jun 4th, 2005, 7:34 PM   #6
mitakeet
Programmer
 
mitakeet's Avatar
 
Join Date: Jun 2005
Location: Maryland, USA
Posts: 59
Rep Power: 4 mitakeet is on a distinguished road
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
mitakeet is offline   Reply With Quote
Old Jun 4th, 2005, 7:52 PM   #7
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
@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
DaWei is offline   Reply With Quote
Old Jun 4th, 2005, 10:36 PM   #8
Infinite Recursion
Programming Guru
 
Infinite Recursion's Avatar
 
Join Date: Jul 2004
Location: United States
Posts: 3,467
Rep Power: 8 Infinite Recursion is on a distinguished road
Send a message via MSN to Infinite Recursion Send a message via Yahoo to Infinite Recursion
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."
Infinite Recursion is offline   Reply With Quote
Old Jun 4th, 2005, 10:39 PM   #9
Infinite Recursion
Programming Guru
 
Infinite Recursion's Avatar
 
Join Date: Jul 2004
Location: United States
Posts: 3,467
Rep Power: 8 Infinite Recursion is on a distinguished road
Send a message via MSN to Infinite Recursion Send a message via Yahoo to Infinite Recursion
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."
Infinite Recursion is offline   Reply With Quote
Old Jun 5th, 2005, 5:12 AM   #10
Nuticulus
Programmer
 
Nuticulus's Avatar
 
Join Date: May 2005
Location: England
Posts: 61
Rep Power: 4 Nuticulus is on a distinguished road
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.
Nuticulus is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 5:13 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC