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

  • Home
  • SEARCH
  • 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 3317424
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T22:35:09+00:00 2026-05-17T22:35:09+00:00

Edit: I incorrectly used #include <stdio.h> when I needed to include <iostream> . This

  • 0

Edit: I incorrectly used #include <stdio.h> when I needed to include <iostream>. This happened mostly because I was integrating some C style code with a larger C++ program.

EndEdit

I’m using a simple test framework for my college class, but whenever I use the provided preprocessor macro I get these two errors. I’ve expanded the macro myself to try and figure out what I’m doing wrong, but I’m stumped.

errors:

src/Url.cpp: In member function ‘bool Url::Test(std::ostream&)’:

src/Url.cpp:35: error: no match for ‘operator<<’ in ‘os << "Test Failed ["’

src/Url.cpp:35: error: ‘endl’ was not declared in this scope

inc/Url.h

#ifndef _URL_H
#define    _URL_H

using namespace std;

class Url {
public:
    Url();
    Url(const Url& orig);
    virtual ~Url();
    bool Test(ostream & os);
    bool setAsUrl(string relOrRegUrl, string baseUrl);
    bool hasUrl();
    string getUrl();
    bool isHtml();

private:
    string fullUrl;
    bool html;

};

#endif    /* _URL_H */

src/Url.cpp

#include <string>
#include <cstring>
#include <stdio.h>
#include "UnitTest.h" //This contains the macro
#include "Url.h"

//using namespace std;

Url::Url() {
    fullUrl = "NULL";
    html = false;
}

Url::Url(const Url& orig) {
}

Url::~Url() {
}

bool Url::Test(ostream & os) {

    bool success = true;

    Url url= Url();
    url.setAsUrl("http://www.cnn.com/news.jpg","http://www.cnn.com");
    do {
        if (!(url.isHtml() == false)) {
            success = false; os << "Test Failed [" << __FILE__ << ", " << __LINE__ << "]" << endl; //line 35
        }
    }while(false);
//    TEST(url.isHtml() == false); this is what gets expanded to the above

    return success;
}


bool Url::setAsUrl(string relOrRegUrl, string baseUrl){
    //Lots of code irrelevant to the question
}

bool Url::hasUrl(){
    return fullUrl == "NULL";
}
string Url::getUrl(){
    return fullUrl;
}
bool Url::isHtml(){
    return html;
}

Sorry about the long line length, that’s what the macro expands to. Oh, and if it helps, what’s being passed into Test() is cout as in

Url url = Url();
url.Test(std::cout);

So, I’m stumped, and if this seems like a dumb question, sorry. I’m new to C++.

  • 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-17T22:35:10+00:00Added an answer on May 17, 2026 at 10:35 pm

    stdio.h is for C functions like printf and scanf.

    If you want to use C++ style I/O (streams) you need to include iostream.

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

Sidebar

Related Questions

No related questions found

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.