clang++ fails to compile simple hello world c++ program
up vote
5
down vote
favorite
After upgrade to 14.04 from 12.04 clang++ stopped working.
$ cat test.cpp
#include <iostream>
int main()
{
std::cout << "Hello World" << std::endl;
return 0;
}
$ clang++ test.cpp
test.cpp:1:10: fatal error: 'iostream' file not found
#include <iostream>
^
1 error generated
Installed with apt-get install clag-3.5
same happened with clang-3.4
Thanks
14.04 c++ clang
add a comment |
up vote
5
down vote
favorite
After upgrade to 14.04 from 12.04 clang++ stopped working.
$ cat test.cpp
#include <iostream>
int main()
{
std::cout << "Hello World" << std::endl;
return 0;
}
$ clang++ test.cpp
test.cpp:1:10: fatal error: 'iostream' file not found
#include <iostream>
^
1 error generated
Installed with apt-get install clag-3.5
same happened with clang-3.4
Thanks
14.04 c++ clang
1
Are you able to compile it withg++
? if not usesudo apt-get install libstdc++-4.8-dev
– Salem
Aug 27 '14 at 21:19
1
of course g++ works...
– Artyom
Aug 29 '14 at 4:09
@Artyom I am see this problem on TravisCI. Everything I am reading tells me I need to compile the libc++ lib separately for Clang.
– Jared Burrows
May 10 '15 at 16:51
For those who are looking for help: stackoverflow.com/questions/22111549/….
– Jared Burrows
May 10 '15 at 17:07
add a comment |
up vote
5
down vote
favorite
up vote
5
down vote
favorite
After upgrade to 14.04 from 12.04 clang++ stopped working.
$ cat test.cpp
#include <iostream>
int main()
{
std::cout << "Hello World" << std::endl;
return 0;
}
$ clang++ test.cpp
test.cpp:1:10: fatal error: 'iostream' file not found
#include <iostream>
^
1 error generated
Installed with apt-get install clag-3.5
same happened with clang-3.4
Thanks
14.04 c++ clang
After upgrade to 14.04 from 12.04 clang++ stopped working.
$ cat test.cpp
#include <iostream>
int main()
{
std::cout << "Hello World" << std::endl;
return 0;
}
$ clang++ test.cpp
test.cpp:1:10: fatal error: 'iostream' file not found
#include <iostream>
^
1 error generated
Installed with apt-get install clag-3.5
same happened with clang-3.4
Thanks
14.04 c++ clang
14.04 c++ clang
asked Aug 27 '14 at 16:37
Artyom
128110
128110
1
Are you able to compile it withg++
? if not usesudo apt-get install libstdc++-4.8-dev
– Salem
Aug 27 '14 at 21:19
1
of course g++ works...
– Artyom
Aug 29 '14 at 4:09
@Artyom I am see this problem on TravisCI. Everything I am reading tells me I need to compile the libc++ lib separately for Clang.
– Jared Burrows
May 10 '15 at 16:51
For those who are looking for help: stackoverflow.com/questions/22111549/….
– Jared Burrows
May 10 '15 at 17:07
add a comment |
1
Are you able to compile it withg++
? if not usesudo apt-get install libstdc++-4.8-dev
– Salem
Aug 27 '14 at 21:19
1
of course g++ works...
– Artyom
Aug 29 '14 at 4:09
@Artyom I am see this problem on TravisCI. Everything I am reading tells me I need to compile the libc++ lib separately for Clang.
– Jared Burrows
May 10 '15 at 16:51
For those who are looking for help: stackoverflow.com/questions/22111549/….
– Jared Burrows
May 10 '15 at 17:07
1
1
Are you able to compile it with
g++
? if not use sudo apt-get install libstdc++-4.8-dev
– Salem
Aug 27 '14 at 21:19
Are you able to compile it with
g++
? if not use sudo apt-get install libstdc++-4.8-dev
– Salem
Aug 27 '14 at 21:19
1
1
of course g++ works...
– Artyom
Aug 29 '14 at 4:09
of course g++ works...
– Artyom
Aug 29 '14 at 4:09
@Artyom I am see this problem on TravisCI. Everything I am reading tells me I need to compile the libc++ lib separately for Clang.
– Jared Burrows
May 10 '15 at 16:51
@Artyom I am see this problem on TravisCI. Everything I am reading tells me I need to compile the libc++ lib separately for Clang.
– Jared Burrows
May 10 '15 at 16:51
For those who are looking for help: stackoverflow.com/questions/22111549/….
– Jared Burrows
May 10 '15 at 17:07
For those who are looking for help: stackoverflow.com/questions/22111549/….
– Jared Burrows
May 10 '15 at 17:07
add a comment |
2 Answers
2
active
oldest
votes
up vote
0
down vote
Your code works for me. Make sure you have libstdc++-dev installed. It's a virtual package, and in my case (Ubuntu 14.04.2 LTS) having 4.8 works.
sudo apt-get install libstdc++-4.8-dev
This doesn't work for me in Ubuntu 14.04.2.
– weberc2
Jul 27 '15 at 20:18
Just "sudo apt-get install libstdc++-dev" may work. It works for me, but there may be another package missing in your case.
– m0j0
Jul 29 '15 at 0:39
add a comment |
up vote
0
down vote
I found to resolve this issue that after installing libstdc++-4.8-dev
package, I need to specify the include paths and lib path to the clang++ like this.
clang++ -I/usr/include/c++/4.8/ -I/usr/include/x86_64-linux-gnu/c++/4.8 -L /usr/lib/gcc/x86_64-linux-gnu/4.8 test.cpp -o test
I found another way. "clang++ -stdlib=libc++ test.cpp -o test"
– Sanya Phungmit
Jan 3 at 14:59
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
Your code works for me. Make sure you have libstdc++-dev installed. It's a virtual package, and in my case (Ubuntu 14.04.2 LTS) having 4.8 works.
sudo apt-get install libstdc++-4.8-dev
This doesn't work for me in Ubuntu 14.04.2.
– weberc2
Jul 27 '15 at 20:18
Just "sudo apt-get install libstdc++-dev" may work. It works for me, but there may be another package missing in your case.
– m0j0
Jul 29 '15 at 0:39
add a comment |
up vote
0
down vote
Your code works for me. Make sure you have libstdc++-dev installed. It's a virtual package, and in my case (Ubuntu 14.04.2 LTS) having 4.8 works.
sudo apt-get install libstdc++-4.8-dev
This doesn't work for me in Ubuntu 14.04.2.
– weberc2
Jul 27 '15 at 20:18
Just "sudo apt-get install libstdc++-dev" may work. It works for me, but there may be another package missing in your case.
– m0j0
Jul 29 '15 at 0:39
add a comment |
up vote
0
down vote
up vote
0
down vote
Your code works for me. Make sure you have libstdc++-dev installed. It's a virtual package, and in my case (Ubuntu 14.04.2 LTS) having 4.8 works.
sudo apt-get install libstdc++-4.8-dev
Your code works for me. Make sure you have libstdc++-dev installed. It's a virtual package, and in my case (Ubuntu 14.04.2 LTS) having 4.8 works.
sudo apt-get install libstdc++-4.8-dev
answered May 18 '15 at 20:07
m0j0
1156
1156
This doesn't work for me in Ubuntu 14.04.2.
– weberc2
Jul 27 '15 at 20:18
Just "sudo apt-get install libstdc++-dev" may work. It works for me, but there may be another package missing in your case.
– m0j0
Jul 29 '15 at 0:39
add a comment |
This doesn't work for me in Ubuntu 14.04.2.
– weberc2
Jul 27 '15 at 20:18
Just "sudo apt-get install libstdc++-dev" may work. It works for me, but there may be another package missing in your case.
– m0j0
Jul 29 '15 at 0:39
This doesn't work for me in Ubuntu 14.04.2.
– weberc2
Jul 27 '15 at 20:18
This doesn't work for me in Ubuntu 14.04.2.
– weberc2
Jul 27 '15 at 20:18
Just "sudo apt-get install libstdc++-dev" may work. It works for me, but there may be another package missing in your case.
– m0j0
Jul 29 '15 at 0:39
Just "sudo apt-get install libstdc++-dev" may work. It works for me, but there may be another package missing in your case.
– m0j0
Jul 29 '15 at 0:39
add a comment |
up vote
0
down vote
I found to resolve this issue that after installing libstdc++-4.8-dev
package, I need to specify the include paths and lib path to the clang++ like this.
clang++ -I/usr/include/c++/4.8/ -I/usr/include/x86_64-linux-gnu/c++/4.8 -L /usr/lib/gcc/x86_64-linux-gnu/4.8 test.cpp -o test
I found another way. "clang++ -stdlib=libc++ test.cpp -o test"
– Sanya Phungmit
Jan 3 at 14:59
add a comment |
up vote
0
down vote
I found to resolve this issue that after installing libstdc++-4.8-dev
package, I need to specify the include paths and lib path to the clang++ like this.
clang++ -I/usr/include/c++/4.8/ -I/usr/include/x86_64-linux-gnu/c++/4.8 -L /usr/lib/gcc/x86_64-linux-gnu/4.8 test.cpp -o test
I found another way. "clang++ -stdlib=libc++ test.cpp -o test"
– Sanya Phungmit
Jan 3 at 14:59
add a comment |
up vote
0
down vote
up vote
0
down vote
I found to resolve this issue that after installing libstdc++-4.8-dev
package, I need to specify the include paths and lib path to the clang++ like this.
clang++ -I/usr/include/c++/4.8/ -I/usr/include/x86_64-linux-gnu/c++/4.8 -L /usr/lib/gcc/x86_64-linux-gnu/4.8 test.cpp -o test
I found to resolve this issue that after installing libstdc++-4.8-dev
package, I need to specify the include paths and lib path to the clang++ like this.
clang++ -I/usr/include/c++/4.8/ -I/usr/include/x86_64-linux-gnu/c++/4.8 -L /usr/lib/gcc/x86_64-linux-gnu/4.8 test.cpp -o test
edited Jan 2 at 17:16
Marc Vanhoomissen
89011119
89011119
answered Jan 2 at 16:02
Sanya Phungmit
1
1
I found another way. "clang++ -stdlib=libc++ test.cpp -o test"
– Sanya Phungmit
Jan 3 at 14:59
add a comment |
I found another way. "clang++ -stdlib=libc++ test.cpp -o test"
– Sanya Phungmit
Jan 3 at 14:59
I found another way. "clang++ -stdlib=libc++ test.cpp -o test"
– Sanya Phungmit
Jan 3 at 14:59
I found another way. "clang++ -stdlib=libc++ test.cpp -o test"
– Sanya Phungmit
Jan 3 at 14:59
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f516801%2fclang-fails-to-compile-simple-hello-world-c-program%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
Are you able to compile it with
g++
? if not usesudo apt-get install libstdc++-4.8-dev
– Salem
Aug 27 '14 at 21:19
1
of course g++ works...
– Artyom
Aug 29 '14 at 4:09
@Artyom I am see this problem on TravisCI. Everything I am reading tells me I need to compile the libc++ lib separately for Clang.
– Jared Burrows
May 10 '15 at 16:51
For those who are looking for help: stackoverflow.com/questions/22111549/….
– Jared Burrows
May 10 '15 at 17:07