Author Topic: Process Terminated?...  (Read 5182 times)

Carver

  • Guest
Process Terminated?...
« on: June 15, 2007, 01:37:41 pm »
Hey!

I sometimes get theese errors when I use Code::Blocks. Right now I've only been using Console Application, but I am pretty sure that it's the same anyways.

It keep saying this after the build:

Code
Project   : Console application
Compiler  : GNU GCC Compiler (called directly)
Directory : C:\Documents and Settings\----\My Documents\CodeBlocks Projects\My Console Application project that SOMETIMES work\
--------------------------------------------------------------------------------
Switching to target: default
Linking console executable: C:\Documents and Settings\----\My Documents\CodeBlocks Projects\My Console Application project that SOMETIMES work\my.exe
.objs\Third program - Variables Data Types.o:Third program - Variables Data Types.cpp:(.text+0x100): multiple definition of `main'
.objs\main.o:main.cpp:(.text+0x100): first defined here
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 0 seconds)
0 errors, 0 warnings

I am using Code::Blocks V. 1.0 (If it helps) on Windows XP. This sometimes automaticly solves itself. I don't know what happens. I've been searching this forum around, but the only things I see is topics with no answers/replies.


Does someone know what to do?

Best Regards,

Carver

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2873
Re: Process Terminated?...
« Reply #1 on: June 15, 2007, 01:44:46 pm »
I've had this happen also. I've searched google, found no answers; just more questions.

And yes, wierdly, on occasion, the problem seems to fix itself.
But I think that's because I add or delete source statements or compile/link  the source in a different order.

Even when it gives a line number for the error, the location is incorrect.

This is not a CodeBlocks problem, because I get the same error when compiling from the MSWindows cmd console.

I believe this is a compiler/linker bug. Or at least a very bad message/explanation.

I'm using:
mingw32-g++ (GCC) 3.4.4 (mingw special)
Copyright (C) 2004 Free Software Foundation, Inc.

I've found no answer to this problem except to search manually.
I do usually find multiple definitions somewhere. Or something that could be construed as multiple definitions.

Or, in my case, an "extern statement"  that doesn't exactly match a signature;

Or a definition that works in C code but not in C++.
I get it alot when mixing my old C modules with new C++ code.

Or a definition in an included header (STL, wxWidgets, or the like) that duplicates one of my own functions.

Or a static definition in one module and a none static definition in another.
« Last Edit: June 15, 2007, 02:12:59 pm by Pecan »

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2873
Re: Process Terminated?...
« Reply #2 on: June 15, 2007, 02:20:07 pm »
Do a "Find in files" for "main" (search on project) and see if there's a definition for it in both types.h/cpp and main.h/cpp

Carver

  • Guest
Process Terminated?...
« Reply #3 on: June 15, 2007, 06:32:45 pm »
Well I found out that it couldn't figure how to have two cpp's in one group. Might be because I was working with a console application, but I have anotherquestion:

Example:

Code
#include <iostream>

using namespace std;

int a;

int main()
{
    int b;
    int c;
   
    cout << "Enter the hours you spent on your PC at day: ";
    cin >> a;
     
    cout << You use<<a<< hours on your PC each day.\n\n";

All this =
Code
Enter the hours you spent on your PC at day:(Example)1
             You use<<a<<(No number?) hours on your PC each day.

What did I do wrong? I mean; I can't do that. Then I tried copying a whole command from a website and it WORKED? O_o

When I type << a << or << b << it doesn't cahnge it at all, in output.

I am a bit new to C++, so might be me, but I did as my tutorial told me to. This was going to be my own very little Nerd test  :|

All that I wrote is only a fraction of what I wrote in the complete.

Best Regards,

Carver

Offline stg

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: Process Terminated?...
« Reply #4 on: June 15, 2007, 07:00:59 pm »
Code
cout << You use<<a<< hours on your PC each day.\n\n";

Where is your initial " ? Did this compile, or did you have something like:
Code
cout << "You use<<a<< hours on your PC each day.\n\n";
Code
cout << "You use " <<a<< " hours on your PC each day.\n\n";


Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9723
Re: Process Terminated?...
« Reply #5 on: June 15, 2007, 07:29:39 pm »
[...] but I have anotherquestion: [...]
This is not Code::Blocks related. This is *not* a C++ forum. Please don't ask such question in this forum - we have strict rules on that topic for good reasons. There are many good C++ forums / newsgroups around for such purposes.
With regards, Morten.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Carver

  • Guest
Re: Process Terminated?...
« Reply #6 on: June 15, 2007, 07:55:54 pm »
Ah ok sorry. I just thought that it could be Code::Blocks doing something, but I haven't tried it out at the original Visual C++ yet.