Noob needs easy help with command line interface
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 9 of 9

Thread: Noob needs easy help with command line interface

  1. #1
    Join Date
    Jul 2014
    Posts
    7

    Noob needs easy help with command line interface

    Hi,

    I am a total idiot when it comes to command line interfaces. Unfortunately I was too young to use the family apple 2c before it was replaced by a windows computer :-(

    Here is my problem. I have a programming assignment (I just need help using command line). It contains main.cpp, person.cpp, and person.h. Main.cpp needs to take and int argc and a char argv (the main declaration is below). Using visual c++'s command line, I am able to change directories so that I am at the correct directory (in this case it is C:\Users\-----\Documents\Visual Studio 2010\Projects\assignment 7 marketing\assignment 7 marketing\main.cpp). I have been able to navigate to C:\Users\------\Documents\Visual Studio 2010\Projects\assignment 7 marketing\assignment 7 marketing, but now what? How do I tell the command line interface to open the project, or compile it, or whatever I need to do to see how this program works? How do I pass it the correct arguments? If someone could please give me a step by step list of what commands I need to input that would be totally helpful. Thanks ahead of time.
    Code:
    int main(int argc, char* argv[])

  2. #2
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Posts
    12,121

    Re: Noob needs easy help with command line interface

    You need to use Visual Studio to create, build, run and debug a project. You'll do that through the Visual Studio GUI, not a command line. That's really something you should know how to do before you post here.

  3. #3
    Join Date
    Jul 2014
    Posts
    7

    Re: Noob needs easy help with command line interface

    GCDEF,

    I know how to create, build and run and debug a project through the visual studio GUI, but I don't know how to pass arguments like those required for

    Code:
    int main(int argc, char* argv[])
    using the visual studio GUI. My teacher has given us examples, but he always used the command line interface using geany, so I assumed that the only way to pass arguments to variables like int argc and char argv was using command line. Is there another way to run a program that requires command line arguments without using command line? That's where I'm kind of hung up on this thing. I just need someone who can briefly inform this nooby which command line arguments I need to enter (and in what order!) to make main.cpp and the associated files person.cpp and person.h run using the command line interface of visual c++, at the same time passing the correct arguments to int argc and char argv. I need to see what this program does before I can get started making the required changes to it and then when I have made those changes, I need to be able to test those changes.

    Thanks ahead of time!

  4. #4
    Join Date
    Jan 2006
    Location
    Singapore
    Posts
    6,315

    Re: Noob needs easy help with command line interface

    Poke around in your IDE's project configuration and other settings and you will find the place where you can enter command line arguments via your IDE.

    You can also open a separate command prompt window and run your program from there with command line arguments entered at the command line.
    C + C++ Compiler: MinGW port of GCC
    Build + Version Control System: SCons + Bazaar

    Look up a C/C++ Reference and learn How To Ask Questions The Smart Way
    Kindly rate my posts if you found them useful

  5. #5
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Posts
    12,121

    Re: Noob needs easy help with command line interface

    Quote Originally Posted by anundal View Post
    GCDEF,

    I know how to create, build and run and debug a project through the visual studio GUI, but I don't know how to pass arguments like those required for

    Code:
    int main(int argc, char* argv[])
    using the visual studio GUI. My teacher has given us examples, but he always used the command line interface using geany, so I assumed that the only way to pass arguments to variables like int argc and char argv was using command line. Is there another way to run a program that requires command line arguments without using command line? That's where I'm kind of hung up on this thing. I just need someone who can briefly inform this nooby which command line arguments I need to enter (and in what order!) to make main.cpp and the associated files person.cpp and person.h run using the command line interface of visual c++, at the same time passing the correct arguments to int argc and char argv. I need to see what this program does before I can get started making the required changes to it and then when I have made those changes, I need to be able to test those changes.

    Thanks ahead of time!
    Go under the project properties and look at the debugging settings. You can specify command line arguments in there.

    This does seem like a VC question. Not sure why the thread was moved.

  6. #6
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Wallisellen (ZH), Switzerland
    Posts
    17,470

    Re: Noob needs easy help with command line interface

    Quote Originally Posted by GCDEF;2159331)anundal
    This does seem like a VC question. Not sure why the thread was moved.
    And what is *specific* to Visual is there in the OP:
    I know how to create, build and run and debug a project through the visual studio GUI, but I don't know how to pass arguments like those required for

    Code:
    int main(int argc, char* argv[])
    using the visual studio GUI

    Function main? Or "visual studio GUI" mentioned by OP?

    Well, If the forum's majority considers this question concerns the Visual aspects of C++ then we could move it back to Visual C++ forum.
    Victor Nijegorodov

  7. #7
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Posts
    12,121

    Re: Noob needs easy help with command line interface

    Quote Originally Posted by VictorN View Post
    And what is *specific* to Visual is there in the OP:
    Function main? Or "visual studio GUI" mentioned by OP?

    Well, If the forum's majority considers this question concerns the Visual aspects of C++ then we could move it back to Visual C++ forum.
    I could be wrong, but I think he's asking how to use Visual Studio to pass command line parameters when running or debugging the app. In post number 3 he says "I don't know how to pass arguments like those required for ... using the visual studio GUI"

  8. #8
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Wallisellen (ZH), Switzerland
    Posts
    17,470

    Re: Noob needs easy help with command line interface

    Quote Originally Posted by GCDEF View Post
    I could be wrong, but I think he's asking how to use Visual Studio to pass command line parameters when running or debugging the app. In post number 3 he says "I don't know how to pass arguments like those required for ... using the visual studio GUI"
    OK, no problem! I will move it back!
    Victor Nijegorodov

  9. #9
    Join Date
    Jul 2014
    Posts
    7

    Re: Noob needs easy help with command line interface

    GCDEF,
    Just wanted to let you know that this:
    "Go under the project properties and look at the debugging settings. You can specify command line arguments in there."
    was the ticket. Got it working now. Thanks a million. I think someone could easily spend a semester just learning all the ins and outs of just the compiler!
    Thank you everyone who took the time to post.

Posting Permissions

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


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center