Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6962961
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T15:43:39+00:00 2026-05-27T15:43:39+00:00

I need to compile code on my linux system. This is simple code and

  • 0

I need to compile code on my linux system. This is simple code and I don’t know what’s wrong:

I have this code and I can’t compile it:

#include <iostream>
#include <string>
using namespace std;

int main()
{
    string char1, char2, char3, char4, char5, char6;
    cout<<"Hello this is your standard True and False quiz"<<endl;
    cout<<"Please enter 'T' or 'F'"<<endl;
    cout<<"No#1 George Washington invented the toilet?"<<endl;
    cin>>char1;
    if ( char1 != "T" || "F")
    {
        cout<<"You entered an incorrect character please reenter True of False"<<endl;
        cin>>char1;
    }
    if ( char1 != "T" || "F")
    {
        cout<<"You entered an incorrect character please reenter True of False"<<endl;
        cin>>char1;
    }
    if ( char1 == "T" )
    {
        cout<<"You entered the incorrect answer. The answer is False"<<endl;
    }
    cout<<"No#2 The Squareroot of 3136 is 56?"<<endl;      
    cin>>char2;
    if ( char2 != "T" || "F")
    {
        cout<<"You entered an incorrect character please reenter True of False"<<endl;
        cin>>char2;
    }
    if ( char2 != "T" || "F")
    {
        cout<<"You entered an incorrect character please reenter True of False"<<endl;
        cin>>char2;
    }
    if ( char2 == "F" )
    {
        cout<<"You entered the incorrect answer. The answer is True"<<endl;
    }
    cout<<"No#3 
    system("PAUSE");
    return 0;
} 

When I try to compile it:

gcc file.c

I get:

test.c:1: fatal error: iostream: No such file or directory
compilation terminated.

As far as I know, I have all the libraries needed, what am I doing wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T15:43:40+00:00Added an answer on May 27, 2026 at 3:43 pm

    You are trying to compile C++ with a C compiler. Try g++ file.c instead.

    Also, it’s good practice to name your file file.cpp instead – naming it .c won’t stop it compiling, but it will help tools like make. Also, it’ll help others who come across your source code later (including yourself).

    Edit: Your code has some other problems which aren’t related to your question, but you’ll run in to them as soon as you get it to compile:

    1. Your ( char1 != "T" || "F") should be ( char1 != "T" && char1 != "F") (note the && instead of ||)
    2. You’re reading another character when you get bad input, but because your code has no loops, the program will exit before it does anything with the next character.
    3. As David Schwartz points out, it’s worth removing system("PAUSE")

    These are pretty common mistakes for newbies to C (Welcome! I’d recommend starting with some tutorials or introductory books. Here is an excellent list of C books and tutorials).

    If you run in to anything you can’t solve on your own, feel free to open another question.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This code does not seem to compile, I just need to write something to
I have here a simple image converter code using Magick++(ImageMagick interface) library.(Eclipse IDE) #include
I need to compile some mfc code that was written using Visual C++ 6.0
I need to know what is code compiled unit in .net. It s located
I need to compile my GWT 1.7 project from my ant build file....anyone know
I need an array where size is known at compile time. I know I
Exceptions in C++ don't need to be caught (no compile time errors) by the
I have a question: How to compile a static library in Linux with gcc
I am tring to port this code to Linux I believe OpenCV uses cmake
What flags do I need to add to g++ in order to compile code

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.