LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 01-15-2004, 07:19 AM   #1
cascamorto
LQ Newbie
 
Registered: Dec 2003
Posts: 11

Rep: Reputation: 0
problem w\ kdeveloper


i wrote a program in c++ in kdeveloper but it gives me a lot of errors so i tried 2 just write the simplest of programs and still it gave me problems:

#include <iostream.h>

void main(){
cout << "hi" << endl;
}

and it gave me a sintax error with cout and something about the file not ending properly (but i think that might just have somethin 2 do with return 0) i used 2 program on microsft visual c++ i don't know if the libraries or something is different on kdeveloper if someone could give e a hand i'd be gratefull.
 
Old 01-15-2004, 07:48 AM   #2
kev82
Senior Member
 
Registered: Apr 2003
Location: Lancaster, England
Distribution: Debian Etch, OS X 10.4
Posts: 1,263

Rep: Reputation: 51
i dont know anything about kdevelop, i use the console myself but iostream.h is very depreciated and should be replaced with iostream. in iostream everything is declared under the std namespace. main should always return something, it is not void. so you need to do

Code:
#include <iostream>

int main() {
    std::cout << "hi" << std::endl;
    return 0;
}
or

Code:
#include <iostream>

using namespace std;

int main() {
    cout << "hi" << endl;
    return 0;
}
if you still get errors then the problem is with kdevelop and/or gcc so i suggest you post the errors that you are getting.

Last edited by kev82; 01-15-2004 at 07:50 AM.
 
Old 01-15-2004, 08:46 AM   #3
deiussum
Member
 
Registered: Aug 2003
Location: Santa Clara, CA
Distribution: Slackware
Posts: 895

Rep: Reputation: 32
The error about the "file not ending properly" is probably just a warning that you don't have a return character at the end of the last non-blank line. Go to the end of the last line and hit enter to get rid of the warning if it annoys you.
 
Old 01-15-2004, 10:38 PM   #4
misfit-x
Member
 
Registered: Jan 2004
Location: NY
Distribution: RH9
Posts: 38

Rep: Reputation: 15
This works fine for me...

#include <iostream>

int main() {
cout << "Hello World" << endl;
return 0;
}
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
kdeveloper cascamorto Programming 10 01-23-2004 10:26 AM
kdeveloper cascamorto Programming 2 01-16-2004 09:30 PM
perl problem? apache problem? cgi problem? WorldBuilder Linux - Software 1 09-17-2003 07:45 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:07 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration