Thread: biggest noob question

  1. #1
    Registered User Guido's Avatar
    Join Date
    Apr 2004
    Posts
    14

    biggest noob question

    how to you build an exe in visual studio.net? im trying to convert from visual studio 6 and im lost =/ apparently build isnt what i want...

  2. #2
    l'Anziano DavidP's Avatar
    Join Date
    Aug 2001
    Location
    Plano, Texas, United States
    Posts
    2,743
    the F5 button i believe.

    if not:

    F9
    Ctrl + F5
    Ctrl + F9

    One of those always works...
    My Website

    "Circular logic is good because it is."

  3. #3
    Registered User Guido's Avatar
    Join Date
    Apr 2004
    Posts
    14
    nope niether of those, it says that it can't find 'test project.exe' (what i named it) so its not even being created...

  4. #4
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    are you trying to name the file "test project.exe"? If so get rid of the space

  5. #5
    Registered User Guido's Avatar
    Join Date
    Apr 2004
    Posts
    14
    didnt work, whenever i press ctrl-f5 it says it cant start because the file does not exist

    edit:renaming didnt work
    edit2: bah i can compile c# files but not c++ and i wanted to try making some c++ files before i went to c#
    Last edited by Guido; 06-08-2004 at 07:37 PM.
    c:\dos
    c:\dos\run
    run dos run

  6. #6
    the hat of redundancy hat nvoigt's Avatar
    Join Date
    Aug 2001
    Location
    Hannover, Germany
    Posts
    3,130
    If you have an existing project from VC6, open it in VC7. Click yes when you are asked to convert. If you want to build a new project, Select new project from the File menu. Make sure you select the right project, C++ if you want C++, C# if you need C#. Select "Build Solution" or "Build" from the menu. Check for any compiler errors. If there are no errors there should be an informational line line "1 Project build, 0 failed, 0 skipped".
    Your executable is now located in the appropriate folder, either bin/Debug or bin/Release. If it was Debug, you can start debugging by pressing the "Play" button in VC7.

    If there are any error-messages in this process, please post them.
    hth
    -nv

    She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate."

    When in doubt, read the FAQ.
    Then ask a smart question.

  7. #7
    Registered User Guido's Avatar
    Join Date
    Apr 2004
    Posts
    14
    ------ Build started: Project: starship, Configuration: Debug Win32 ------

    Compiling...
    ship.cpp
    Linking...
    LINK : warning LNK4075: ignoring '/EDITANDCONTINUE' due to '/INCREMENTAL:NO' specification
    LIBCD.lib(crt0.obj) : error LNK2019: unresolved external symbol _main referenced in function _mainCRTStartup
    .\Debug/starship.exe : fatal error LNK1120: 1 unresolved externals

    Build log was saved at "file://c:\Program Files\Microsoft Visual Studio\MyProjects\starship\Debug\BuildLog.htm"
    starship - 2 error(s), 1 warning(s)


    ---------------------- Done ----------------------

    Build: 0 succeeded, 1 failed, 0 skipped


    i dunno if this has anything to do with it but i am using allegro.h and alleg.lib in the project
    c:\dos
    c:\dos\run
    run dos run

  8. #8
    the hat of redundancy hat nvoigt's Avatar
    Join Date
    Aug 2001
    Location
    Hannover, Germany
    Posts
    3,130
    ------ Build started: Project: starship, Configuration: Debug Win32 ------

    Compiling...
    ship.cpp
    Linking...
    LINK : warning LNK4075: ignoring '/EDITANDCONTINUE' due to '/INCREMENTAL:NO' specification
    LIBCD.lib(crt0.obj) : error LNK2019: unresolved external symbol _main referenced in function _mainCRTStartup
    .\Debug/starship.exe : fatal error LNK1120: 1 unresolved externals

    Build log was saved at "file://c:\Program Files\Microsoft Visual Studio\MyProjects\starship\Debug\BuildLog.htm"
    starship - 2 error(s), 1 warning(s)


    ---------------------- Done ----------------------

    Build: 0 succeeded, 1 failed, 0 skipped




    This is called a compiler error

    You don't have a main function in your program. Maybe you have a windows application but created your new project as console application ?
    hth
    -nv

    She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate."

    When in doubt, read the FAQ.
    Then ask a smart question.

  9. #9
    Registered User Guido's Avatar
    Join Date
    Apr 2004
    Posts
    14
    void main()
    {

    }


    whats wrong with that?
    c:\dos
    c:\dos\run
    run dos run

  10. #10
    the hat of redundancy hat nvoigt's Avatar
    Join Date
    Aug 2001
    Location
    Hannover, Germany
    Posts
    3,130
    Besides the fact that main should return an int, anything else can result in undefined behaviour, I see nothing wrong with it.

    Change it to return int and make sure this file is in the project.
    hth
    -nv

    She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate."

    When in doubt, read the FAQ.
    Then ask a smart question.

  11. #11
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681

  12. #12
    Registered User
    Join Date
    Aug 2004
    Posts
    4

    LNK4075 - WinMain vs main

    I get the same link error.
    I am using the following instead of a main function:

    int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nShowCmd)

    {
    /*MyGameWindow class is defined before opening WinMain*/
    MyGameWindow myWindow;

    myWindow.Create (hInstance, "My First Game");
    myWindow.SetSize (640, 480);

    myWindow.Init (hInstance);
    myWindow.Run ();

    return 0;
    }

    Can I fix this without switching off the incremental:no option?

    Thanks

  13. #13
    the hat of redundancy hat nvoigt's Avatar
    Join Date
    Aug 2001
    Location
    Hannover, Germany
    Posts
    3,130
    Yes, make sure your project is build for SUBSYSTEM:WINDOWS. Browse through your project or solutions properties, it has to be in there somewhere ( don't have a compiler on this pc ).
    hth
    -nv

    She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate."

    When in doubt, read the FAQ.
    Then ask a smart question.

  14. #14
    Registered User dalek's Avatar
    Join Date
    May 2003
    Posts
    135
    Its in project properties (right click on your project in the solution window and select properties) /Linker/System. You need to change the SubSystem field to either "Console(/SUBSYSTEM:CONSOLE)" or "Windows(/SUBSYSTEM:WINDOWS)" depending on what you are trying to compile.

    Its console if you have:
    Code:
    int main()
    {
    }
    and windows if you have:
    Code:
    int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
    {
    }
    Last edited by dalek; 08-12-2004 at 03:53 AM.

  15. #15
    Registered User
    Join Date
    Aug 2004
    Posts
    6
    Hi i think you have to put the main function in a class in C# like this.

    class Name
    {
    public static void Main()
    {
    Like in Java just main with a big M. And to build you puch ctrl + shift + b. then use F5 to debug.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. quick noob question
    By thanatos1 in forum C# Programming
    Replies: 2
    Last Post: 06-17-2009, 08:28 PM
  2. another noob question
    By clb2003 in forum C Programming
    Replies: 4
    Last Post: 02-12-2009, 01:28 PM
  3. Noob printf question
    By lolguy in forum C Programming
    Replies: 3
    Last Post: 12-14-2008, 08:08 PM
  4. Very noob question :(.
    By GamerProduction in forum Tech Board
    Replies: 4
    Last Post: 04-14-2007, 05:40 AM
  5. Noob question ( little dos program )
    By Demon1s in forum C++ Programming
    Replies: 13
    Last Post: 04-04-2003, 09:28 PM