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 881987
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T12:21:17+00:00 2026-05-15T12:21:17+00:00

I followed a simple example as below. But compile failed. Could you please have

  • 0

I followed a simple example as below. But compile failed.

Could you please have a look and give me some suggestion.

vs2010 console application used.Thank you.

Error message

pgm.h(11): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
pgm.h(11): error C2143: syntax error : missing ',' before '&'
1>  multi_fct.cpp
pgm.h(11): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
pgm.h(11): error C2143: syntax error : missing ',' before '&'
1>  ch3_p96.cpp
pgm.h(11): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
pgm.h(11): error C2143: syntax error : missing ',' before '&'
ch3_p96.cpp(24): error C2664: 'prn_info' : cannot convert parameter 1 from 'const char [8]' to 'const int'
1>          There is no context in which this conversion is possible
ch3_p96.cpp(26): error C3861: 'fct1': identifier not found

pgm.h

#include <iostream>
#include <cstdlib>
#include <string>

#define     N   3

void fctl(int k);
void fct2();
void prn_info(const string& pgm_name);

ch3_p96.cpp

#include "stdafx.h"

#include <iostream>

#include "pgm.h"

using namespace std;

int main()
{
    char ans;
    int  k, n = N;

    cout << "This program does not do very much.\n";
    cout << "Do you want more information?\n";
    cout << "Enter either y or Y is yes.\n" << endl;

    cin >> ans;

    if (ans == 'y' || ans == 'Y')
        prn_info("ch3_p96");    // multi_main
    for (k = 0; k < n; ++k)
        fct1(k);

    cout << "Best Regards!" << endl;

}

multi_fct.cpp

#include "StdAfx.h"

#include <iostream>
#include "pgm.h"

using namespace std;

void fct1(int n)
{
    int i;

    cout << "Hello from fct1()" << endl;
    for (i = 0; i < n; ++i)
        fct2();
}

void fct2()
{
    cout << "Hello from fct2()" << endl;

}

multi_prn.cpp

#include "StdAfx.h"

#include <iostream>
#include <string>
#include "pgm.h"

using namespace std;

void prn_info(const string& pgm_name)
{
    cout << "Usage:  " << pgm_name << endl;
    cout << "This program illustrates a   " << endl;
    cout << "Program is more than one file.    " << endl;
    cout << "In this example, a single" << endl;
    cout << ".h file is included at the" << endl;
    cout << "top of our three .cpp files." << endl;
    cout << "Thus pgm.h acts as the \"glue\"" << endl;
    cout << "that binds the program." << endl;
}
  • 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-15T12:21:18+00:00Added an answer on May 15, 2026 at 12:21 pm

    You need to namespace qualify string: std::string.

    The compiler error is saying that it didn’t find a type name, so it’s guessing that string is an int, and continuing to try and parse your code.

    Also, in one place you use fctl (fct lower-case-L) and in one place you use fct1 (fct one).

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

Sidebar

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.