Visual studio functions

This is a discussion on Visual studio functions within the Windows Programming forums, part of the Platform Specific Boards category; When I try to declare a function in Visual Studio 2010 Pro I always get an error. The code below ...

  1. #1
    Registered User
    Join Date
    Jul 2011
    Posts
    2

    Visual studio functions

    When I try to declare a function in Visual Studio 2010 Pro I always get an error. The code below is what I am trying to build. Am I missing something? Thanks for the help.

    Code:
    // void function example
    #include <iostream>
    #include "stdafx.h"
    using namespace std;
    
    void printmessage ()
    {
      cout << "I'm a function!";
    }
    
    int main ()
    {
      printmessage ();
      return 0;
    }
    Last edited by Matt_B; 07-29-2011 at 02:31 PM.

  2. #2
    'Allo, 'Allo, Allo
    Join Date
    Apr 2008
    Posts
    611
    Fatal Error C1010
    Use either of the methods. Prefer the first one if you're just starting out.

  3. #3
    Registered User
    Join Date
    Jul 2011
    Posts
    2
    Thanks that solved it

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Visual C++ and Visual Studio 2010
    By 03jh01 in forum C++ Programming
    Replies: 5
    Last Post: 10-03-2010, 04:03 AM
  2. Replies: 6
    Last Post: 06-16-2009, 05:37 AM
  3. visual studio 5: exporting functions in a dll
    By techi_talk in forum C Programming
    Replies: 1
    Last Post: 08-07-2006, 09:58 AM
  4. visual studio 6 and visual studio.net difference
    By gemini_shooter in forum Tech Board
    Replies: 5
    Last Post: 02-04-2006, 12:32 AM
  5. Replies: 1
    Last Post: 05-26-2004, 09:59 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21