CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7

Threaded View

  1. #1
    Join Date
    May 2010
    Posts
    23

    Unhappy new to c++, getting error

    Hello, here is my simple program which I am trying to compile and run.

    Code:
    # include <iostream>
    
    int main() 
    {
    	cout << "Hello World" << end1;
    	int sum = 0;
    	
    	for(int index = 0; index <= 10; index++)
    	{
    		sum += index;
    	}
    	
    	cout << "The sum is: " << sum << end1;
    	
    	return 0;
    }
    the name of file is firstCPlusPlus.cpp

    When I enter 'g++ firstCPlusPlus.cpp into terminal window, get this error:

    Undefined symbols:
    "_main", referenced from:
    start in crt1.10.6.o
    ld: symbol(s) not found
    collect2: ld returned 1 exit status

    Any help would be great. Thinking my code is alright but my compiler side of things is messed. New to the game of c++ and frustrated with this error

    Thanks to all for any advice!
    Last edited by Marc G; December 18th, 2010 at 10:50 AM. Reason: Added code tags

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured