I want to get started with C++ programing, so I installed gcc and gcc-c++ packages and created a file test.cpp containing the following:
#include <iostream>
int main(){
cout<<"Hello world!";
return 0;
}
and in the terminal got the following output:
dean@dean-suse:~/C++> g++ test.cpp -o test
/usr/lib/gcc/i586-suse-linux/4.3/../../../../i586-suse-linux/bin/ld: crt1.o: No such file: No such file or directory
collect2: ld returned 1 exit status
dean@dean-suse:~/C++> gedit test.cpp
dean@dean-suse:~/C++> gcc test.cpp -o test
test.cpp:1:20: error: iostream: No such file or directory
test.cpp: In function ‘int main()’:
test.cpp:3: error: ‘cout’ was not declared in this scope
I started learning C++ while I was using Windows, but I have absolutely no experience with Linux compiling. Can anyone tell me where I can get the needed libraries to compile this simple program?
To compile C++ programs you need g++ installed and then run “g++ yourprogram.cpp -o yourprogram” to compile it. I can’t give any more information than this as I’m still a newbie in C++ myself.
Thanks, EarthMind. I’ve actually been through these tutorials in windows. The real problem is compiling.
I installed all packages in the “Base development” category and now it shows the following:
dean@dean-suse:~/C++> g++ test.cpp -o test
test.cpp: In function ‘int main()’:
test.cpp:3: error: ‘iostream’ was not declared in this scope
dean@dean-suse:~/C++> g++ test.cpp -o test
test.cpp: In function ‘int main()’:
test.cpp:3: error: ‘cout’ was not declared in this scope
dean@dean-suse:~/C++>
Okay, I want to learn to use the qt library, but I can’t find the packages needed to use that. I try #include<qapplication> and qapplication.h, but it just doesn’t work, saying: “qapplication.h: No such file or directory”. Can anyonew help me?