ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Distribution: Slackware-13,Slackware64-13.37,Vector linux
Posts: 14
Rep:
Problem in compiling c++ prg's
Hey Slacker pls help me !
I've installed Slackware 13[DVD-whole setup]
which include gcc-base and gcc-g++
but I've problem compiling even a simple "Hello world" prg in g++.
It show the error msg:
error in function main():
'cout' was not declared in the scope
'endl' was not declared in the scope
The gcc (.c) files are fine
I've tried installing the whole pkgs of 'gcc' many times
even the OS
It's simply a programming error. Like Komakino said it, you probably didn't use the iostream library or the std namespace. In C++, cout and endl are defined in the std namespace (using namespace std; ) and you also need to include iostream library ( #include <iostream>). You can find a good C++ tutorial at http://www.learncpp.com/
Quote:
Originally Posted by sach1n
Hey Slacker pls help me !
I've installed Slackware 13[DVD-whole setup]
which include gcc-base and gcc-g++
but I've problem compiling even a simple "Hello world" prg in g++.
It show the error msg:
error in function main():
'cout' was not declared in the scope
'endl' was not declared in the scope
The gcc (.c) files are fine
I've tried installing the whole pkgs of 'gcc' many times
even the OS
I fail to see how this is a Slackware issue. Can this thread be moved to the programming forum?
Eric
I believe the OP thought his issue was related to not having the correct slack packages installed, but you're right in that this isn't a Slackware specific issue and should probably be moved.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.