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:
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
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:
#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 = 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
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:
cout << "You use<<a<< hours on your PC each day.\n\n";
cout << "You use " <<a<< " hours on your PC each day.\n\n";