Ask Experts Questions for FREE Help !
Ask
    lightbulb365's Avatar
    lightbulb365 Posts: 5, Reputation: 1
    New Member
     
    #1

    Jul 1, 2009, 01:27 PM
    Error C2447
    I get the following error:

    ----- Build started: Project: Program++, Configuration: Debug Win32 ------
    Compiling...
    Helloworld.cpp
    Name.cpp
    c:\parish\generic_pa_1\program++\program++\name.cp p(6) : error C2447: '{' : missing function header (old-style formal list?)
    Generating Code...
    Build log was saved at "file://c:\Parish\Generic_Pa_1\Program++\Program++\Debug\B uildLog.htm"
    Program++ - 1 error(s), 0 warning(s)
    ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

    When I tried compliling the following program on VC++2008:

    #include<iostream>
    #include<string>



    {
    using namespace std;
    string s;
    cout << "Please enter your first name followed by a newline\n";
    cin >> s;
    cout << "Hello, " << s << '\n';
    return 0; /* this return statement isn't necessary */
    }

    Please help.
    grim_2020's Avatar
    grim_2020 Posts: 4, Reputation: 1
    New Member
     
    #2

    Jul 9, 2009, 04:37 AM
    You are not defining a function there.

    Code:
    #include<iostream>
    #include<string>
    
    int main()
    {
    	using namespace std;
    	string s;
    	cout << "Please enter your first name followed by a newline\n";
    	cin >> s;
    	cout << "Hello, " << s << '\n';
    	return 0; /* this return statement isn't necessary */
    }
    lightbulb365's Avatar
    lightbulb365 Posts: 5, Reputation: 1
    New Member
     
    #3

    Jul 9, 2009, 06:39 AM
    I figured the function definition part out. However it wasn't as straightforward as that. VC++ does not like it if there are more than one programs open at the same time. It expects a function declaration only once (in one of the open programs) in that case. That was the reason why I didn't have a declaration to begin with. However after the error messages I decided to have just the one program open (with a function declaration) and it worked!
    grim_2020's Avatar
    grim_2020 Posts: 4, Reputation: 1
    New Member
     
    #4

    Jul 9, 2009, 03:13 PM
    I believe you have multiple c++ files with main entry points in the same project instead of creating a new project for each program.

    Project with multiple main's



    Multiple projects with one main


Not your question? Ask your question View similar questions

 

Question Tools Search this Question
Search this Question:

Advanced Search

Add your answer here.


Check out some similar questions!

IE printing error: res://ieframe.dll/preview.dlg error [ 15 Answers ]

I have seen about a dozen posts on different Web sites regarding this error. The most common fixes are related to an individual work station. We are experiencing this problem with our Web site and everyone accessing it is unable to print pages that are within frames. I tried the fixes on my...

Oracle Error 12560:tns Protocol Adapter Error [ 3 Answers ]

Hi, Whenever I try to log in using SCOTT/TIGER userid, I get the error "ORA ERROR 12560:TNS PROTOCOL ADAPTER ERROR". I tried starting the listener from administration-> services, but still the problem persists. Can you please suggest a solution?

Printing Error-Script Error [ 1 Answers ]

When I try to print a window pops up: Internet Explorer Script Error Line:1174 I have tried several things: Quick Restore, checked Script debugging box.


View more questions Search