Shoutbox

[Solved] Error on Dev-C++ - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Skype & Technology (/forumdisplay.php?fid=9)
+---- Forum: Tech Talk (/forumdisplay.php?fid=17)
+----- Thread: [Solved] Error on Dev-C++ (/showthread.php?tid=81994)

[Solved] Error on Dev-C++ by Chancer on 02-29-2008 at 12:09 AM

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.
RE: Error on Dev-C++ by Naruto-SR on 02-29-2008 at 12:34 AM

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.


RE: Error on Dev-C++ by Chancer on 02-29-2008 at 05:44 PM

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.
RE: Error on Dev-C++ by Chancer on 03-02-2008 at 07:12 PM

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.


RE: Error on Dev-C++ by Mike on 03-02-2008 at 08:13 PM

quote:
Originally posted by Chancer
Edit: Does it work with Windows Vista?
Don't think so...
RE: Error on Dev-C++ by Chancer on 03-02-2008 at 11:40 PM

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]


RE: Error on Dev-C++ by vikke on 03-02-2008 at 11:53 PM

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.


RE: Error on Dev-C++ by Chancer on 03-02-2008 at 11:56 PM

SOLVED =D
This page gave me the hints I needed.
It's working fine now!