none
beginner c++

    Question

  • dear all,

    i have questions why everytime i create a cpp files i must save into diff workspace.if not there will be an error mentioned "c:\age.cpp(23) : warning C4508: 'main' : function should return a value; 'void' return type assumed
    Linking...

    what is the use for workspace ?

     

    Thanks in advance.

    Wednesday, May 03, 2006 2:55 PM

Answers

  • This is not related to whether you are using a workspace.  Your warning level is set differently between the command-line invocation of cl.exe, and the project-invocation of it. 

     

    Wednesday, May 03, 2006 3:23 PM
  • Hi,
    that's not an error, it's a warning as it says in the message. That warning means that you're not putting a return type in the function you're declaring:

    [ReturnType] MyFunction([Arguments if any]) {}

    in your case:

    main() {}

    You're not putting a return type in the main.


    The error you're referring I guess that's caused because you have multiple main functions (the main function is the default entry point of your application, where the program starts running) and you can only have one.

    A workspace is a project. Just a simple example, imagine that you build a library that could be used in different projects. In your solution you could have a workspace that is the library and other project that is a program that uses that library.
    In your case you have to create different workspaces because each one of them can only have an entry point (main function).
    Wednesday, May 03, 2006 3:26 PM

All replies

  • This is not related to whether you are using a workspace.  Your warning level is set differently between the command-line invocation of cl.exe, and the project-invocation of it. 

     

    Wednesday, May 03, 2006 3:23 PM
  • Hi,
    that's not an error, it's a warning as it says in the message. That warning means that you're not putting a return type in the function you're declaring:

    [ReturnType] MyFunction([Arguments if any]) {}

    in your case:

    main() {}

    You're not putting a return type in the main.


    The error you're referring I guess that's caused because you have multiple main functions (the main function is the default entry point of your application, where the program starts running) and you can only have one.

    A workspace is a project. Just a simple example, imagine that you build a library that could be used in different projects. In your solution you could have a workspace that is the library and other project that is a program that uses that library.
    In your case you have to create different workspaces because each one of them can only have an entry point (main function).
    Wednesday, May 03, 2006 3:26 PM
  • hi all,

    im just a beginner in visual c++ programing. 
    i dont know how to compile, build and run.

    please help me...

    thanks
    Saturday, July 26, 2008 7:22 AM