What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Skype & Technology » Tech Talk » [Solved] Error on Dev-C++

[Solved] Error on Dev-C++
Author: Message:
Chancer
Senior Member
****

Avatar

Posts: 648
Reputation: 7
34 / Male / Flag
Joined: May 2005
Status: Away
O.P. [Solved] Error on Dev-C++
Hey!
I'm on university now, and I'm gonna learn C.
So I downloaded Dev-C++ and accessed my school's tutorial.

Here is the code:

code:
#include <stdio.h>

int main()
{
  int n, par, impar, num;
 
  printf("Digite o tamanho da sequencia: "); /* mostra mensagem na tela  */
  scanf("%d", &n);                           /* le informacao do teclado */ 

  par   = 0;
  impar = 0;
  cont  = 0;
  while (cont < n)
    {
      printf("Digite o %do. numero: ", cont+1);
      scanf("%d", &num);
      if (num%2 == 0) par = par + 1;
      else impar = impar + 1;
      cont = cont + 1;
    }
 
  printf("A sequencia e' formada por %d numeros pares e %d impares.\n\n",
         par,impar)

  return 0;
}

Actually it's not about the code, cuz it's correct. But when I click "compile", the program can't do this and show me "[Build Error] [main.o] Error 1".

Do you have any idea about it?

Edit: I was looking for other tutorials, and it seems to happen to everyone I try.

This post was edited on 03-02-2008 at 11:56 PM by Chancer.
02-29-2008 12:09 AM
Profile E-Mail PM Find Quote Report
Naruto-SR
Junior Member
**

Avatar

Posts: 47
Reputation: 4
43 / Male / Flag
Joined: Feb 2008
RE: Error on Dev-C++
1. Have you got version 4.92 version of Dev C++ (it works best).

2. Attempt to compile a project that does not require the user to add any of his/her own code.

Such as:

Create new project, select windows app, save as project 1. From that point, simply compile. That should give you a simple gui_window application, and no problems. If that works, then you have been compiling your projects incorrectly. Anytime you create a new project and you wish to add your own main.cpp files (or any other name for that matter) always remove any dev-generated cpp files from the project; then add your own sources to the project. Header files are not added to your project as you probably may already now, but you link them, ie. #include <"myheader.h">. Resource files are added by going to toolbar, project, add resource file. All of the steps need to be done correctly to avoid compilation errors.
02-29-2008 12:34 AM
Profile PM Find Quote Report
Chancer
Senior Member
****

Avatar

Posts: 648
Reputation: 7
34 / Male / Flag
Joined: May 2005
Status: Away
O.P. RE: Error on Dev-C++
I'm using 4.9.9.2 and programming C, not C++.
I tried it: New project -> Introduction -> Hello World.

This one should be compiled, as it's code is ready. However, I get the same error.

I'll try to reinstall it.

Edit: Does it work with Windows Vista?
And also, I forgot to mention that the error occurs on the file "Makefile.win".
I opened it with notepad:

code:
# Project: Project1
# Makefile created by Dev-C++ 4.9.9.2

CPP  = g++.exe
CC   = gcc.exe
WINDRES = windres.exe
RES  =
OBJ  = main.o $(RES)
LINKOBJ  = main.o $(RES)
LIBS =  -L"C:/USP/Dev-Cpp/lib" 
INCS =  -I"C:/USP/Dev-Cpp/include"
CXXINCS =  -I"C:/USP/Dev-Cpp/lib/gcc/mingw32/3.4.2/include"  -I"C:/USP/Dev-Cpp/include/c++/3.4.2/backward"  -I"C:/USP/Dev-Cpp/include/c++/3.4.2/mingw32"  -I"C:/USP/Dev-Cpp/include/c++/3.4.2"  -I"C:/USP/Dev-Cpp/include"
BIN  = Project1.exe
CXXFLAGS = $(CXXINCS) 
CFLAGS = $(INCS) 
RM = rm -f

.PHONY: all all-before all-after clean clean-custom

all: all-before Project1.exe all-after


clean: clean-custom
    ${RM} $(OBJ) $(BIN)

$(BIN): $(OBJ)
    $(CC) $(LINKOBJ) -o "Project1.exe" $(LIBS)

main.o: main.c
    $(CC) -c main.c -o main.o $(CFLAGS)


C:/USP/Dev-Cpp/ is where I installed it.

This post was edited on 02-29-2008 at 05:53 PM by Chancer.
02-29-2008 05:44 PM
Profile E-Mail PM Find Quote Report
Chancer
Senior Member
****

Avatar

Posts: 648
Reputation: 7
34 / Male / Flag
Joined: May 2005
Status: Away
O.P. RE: Error on Dev-C++
I was trying another program, SciTE, and also compiling thru command line.
In both cases I get this message:
gcc: installation problem, cannot exec `cc1': No such file or directory
On SciTE I also receive Exit code: 1, the same error that Dev-C++ shows me. Coincidence? I don't think so...

I googled about it, found some sites about Linux, but no answers.
03-02-2008 07:12 PM
Profile E-Mail PM Find Quote Report
Mike
Elite Member
*****

Avatar
Meet the Spam Family!

Posts: 2795
Reputation: 48
31 / Male / Flag
Joined: Mar 2003
Status: Online
RE: Error on Dev-C++
quote:
Originally posted by Chancer
Edit: Does it work with Windows Vista?
Don't think so...
YouTube closed-captions ripper (also allows you to download videos!)
03-02-2008 08:13 PM
Profile E-Mail PM Web Find Quote Report
Chancer
Senior Member
****

Avatar

Posts: 648
Reputation: 7
34 / Male / Flag
Joined: May 2005
Status: Away
O.P. RE: Error on Dev-C++
I'm making progress.
I added the gcc folder to enviroment variables "Path".It just makes easier to compile via command line.
Also, I placed cc1.exe at the same folder gcc.exe is, but I still have problems:
[Image: cmdlo7.png]

This post was edited on 03-02-2008 at 11:41 PM by Chancer.
03-02-2008 11:40 PM
Profile E-Mail PM Find Quote Report
vikke
Senior Member
****

Avatar

Posts: 900
Reputation: 28
31 / Male / Flag
Joined: May 2006
RE: Error on Dev-C++
Add the Platform SDK (get it from MSDN.com) include path to the Path enviroment variable. Try to compile again.
I've never used Dev-C++, maybe it requires its own special Windows-headers, but let's hope it can use the ones from the Platform SDK.
4 8 15 16 23 42
03-02-2008 11:53 PM
Profile E-Mail PM Find Quote Report
Chancer
Senior Member
****

Avatar

Posts: 648
Reputation: 7
34 / Male / Flag
Joined: May 2005
Status: Away
O.P. RE: Error on Dev-C++
SOLVED =D
This page gave me the hints I needed.
It's working fine now!
03-02-2008 11:56 PM
Profile E-Mail PM Find Quote Report
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On