PDA

View Full Version : [SOLVED] g++ Problems



Primefalcon
November 11th, 2008, 07:59 AM
I seem to be having weird problem

I have the following real simple c++ program


#include <iostream.h>
using namespace std;

int main()
{
cout << "testing";

return 0;
}

which shouldn't be a problem.....

yet

primefalcon@BlackBeard:~/Desktop/testing$ g++ program.cpp -o program
primefalcon@BlackBeard:~/Desktop/testing$ ./program
primefalcon@BlackBeard:~/Desktop/testing$

obviously something weird is going on I tried reinstall g++ but with no luck.

I am using Ubuntu 8.04.

I am not sure what to look into to fix this problem either the compiler is having a problem or I am having a problem running the program not sure which.

Any help would be appreciated thank you

lisati
November 11th, 2008, 08:11 AM
One thing to check is if the "build-essential" package is installed. You can do this by entering the following in the terminal:

sudo apt-get build-essential

Primefalcon
November 11th, 2008, 08:11 AM
I've tried reinstalling the compiler no luck there either

Primefalcon
November 11th, 2008, 08:14 AM
I already do have that installed though I just tried reinstalled the build-essential pack, no luck.....

Primefalcon
November 11th, 2008, 08:24 AM
anyone?

namegame
November 11th, 2008, 08:26 AM
I'm not sure if this is the exact problem, but instead of:

#include <iostream.h>

try this:

#include <iostream>

Primefalcon
November 11th, 2008, 08:44 AM
unfrotunately no that's what i had originaly.... :-( it says I have both of those lib files though

Primefalcon
November 11th, 2008, 08:48 AM
Ok I've tested old c++ programs I had compiled and they work, so its the gnu c++ compiler that isn't working for sure

dmizer
November 11th, 2008, 08:55 AM
Moved to Programming talk. People here will be more likely to help you.

Please refrain from bumping your post so frequently. You will still receive help even if your post has dropped off the front page. If you have not received a reply within 24 hours, please feel free to bump. If you need more speedy help, please try using the IRC channel instead.

Thank you.

Primefalcon
November 11th, 2008, 09:01 AM
I apologize I just needed this work pretty urgently....

though I have one tiny issue the bloody thing just started working now, I didn't do anything to fix it.....

Bichromat
November 11th, 2008, 11:09 AM
I seem to be having weird problem

I have the following real simple c++ program


#include <iostream.h>
using namespace std;

int main()
{
cout << "testing";

return 0;
}


You didn't end the line with "\n" or endl. Maybe you program doesn't flush the output as a consequence.

dwhitney67
November 11th, 2008, 02:17 PM
You didn't end the line with "\n" or endl. Maybe you program doesn't flush the output as a consequence.

+1.

Also, the program will not compile unless the .h is removed from the #include <iostream> statement.




$ g++ program.cpp
program.cpp:1:22: error: iostream.h: No such file or directory
program.cpp: In function ‘int main()’:
program.cpp:8: error: ‘cout’ was not declared in this scope