Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » eclipse c/c++ IDE cannot compile when using iostream
eclipse c/c++ IDE cannot compile when using iostream [message #1857806] Mon, 27 February 2023 04:39 Go to next message
w t is currently offline w tFriend
Messages: 3
Registered: January 2013
Junior Member
Running Ubuntu 22.04
Installed eclipse-cpp-2022-12-R-linux-gtk-x86_64
Installed Meson via the ubuntu repository

The issue is that I cannot compile the application when using iostream. If it is an eclipse configuration issue, could you direct me how to properly configure eclipse?

Thanks.


I created a stock c++ project with accompanying stock code

#include <stdio.h>
int main(int argc, char **argv) {
	printf("Hello World\n");
	return 0;
}


Everything compile well and run as expected.

I then changed the code to use iostream and it fails to compile

#include <iostream>
int main(int argc, char **argv) {
	std::cout << "hello world via cout" << '\n';
	return 0;
}


The console output show...

Building in: /home/wt/user1/myworkspace/test-cpp/build/default
[1/2] cc -Itest-cpp.p -I. -I../.. -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -g -MD -MQ test-cpp.p/test-cpp.c.o -MF test-cpp.p/test-cpp.c.o.d -o test-cpp.p/test-cpp.c.o -c ../../test-cpp.c
FAILED: test-cpp.p/test-cpp.c.o 
cc -Itest-cpp.p -I. -I../.. -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -g -MD -MQ test-cpp.p/test-cpp.c.o -MF test-cpp.p/test-cpp.c.o.d -o test-cpp.p/test-cpp.c.o -c ../../test-cpp.c
../../test-cpp.c:1:10: fatal error: iostream: No such file or directory
    1 | #include <iostream>
      |          ^~~~~~~~~~
compilation terminated.
ninja: build stopped: subcommand failed.
Build complete: /home/wt/user1/myworkspace/test-cpp/build/default
Re: eclipse c/c++ IDE cannot compile when using iostream [message #1857809 is a reply to message #1857806] Mon, 27 February 2023 09:36 Go to previous message
w t is currently offline w tFriend
Messages: 3
Registered: January 2013
Junior Member
Found the issue. I created a project that is using cc instead of gcc to compile the code.
Previous Topic:True post-build actions
Next Topic:G-option in Eclipse
Goto Forum:
  


Current Time: Tue Jan 14 03:31:09 GMT 2025

Powered by FUDForum. Page generated in 0.04113 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top