Thread: Please help (noob problem)

  1. #1
    Registered User
    Join Date
    Nov 2013
    Posts
    3

    Please help (noob problem)

    Hello everyone, this is my first post on this forum. I am new to C++ and I am teaching myself how to program using a guidebook so please recognize that currently, I am nowhere near proficient at C++. In the process of creating my first C++ program (a simple "Hello World!" program) I have run into a minor problem.

    My problem: I have g++ on my machine, verified through the command prompt. However, when I attempt to compile and link my program, I run into this error: I type in: g++ Motto.cpp -o Motto.exe into the command prompt as directed by the guidebook however I am confronted with this error message:
    g++: error: Motto.cpp: No such file or directory
    g++: fatal error: no input files
    compilation terminated

    I'm trying to figure out what the problem is exactly and how I can fix it. From what I can tell I have followed the directions in the book. I am searching for a thorough, in-depth answer as I am seeking to gain as much knowledge in Programming as I can. If possible, tell me more than "how" to fix it, I want to know why doing what you tell me is going to work. Thank you for taking the time to help a newb.

    Regards,

    ~Cheyne

  2. #2
    Registered User MutantJohn's Avatar
    Join Date
    Feb 2013
    Posts
    2,665
    Idk if this will work but have you tried :
    g++ -o Motto.exe Motto.cpp

  3. #3
    Registered User
    Join Date
    Nov 2013
    Posts
    3
    Quote Originally Posted by MutantJohn View Post
    Idk if this will work but have you tried :
    g++ -o Motto.exe Motto.cpp
    I appreciate you trying to help. I just tried your suggestion and it did not work, same error message unfortunately.

  4. #4
    Registered User MutantJohn's Avatar
    Join Date
    Feb 2013
    Posts
    2,665
    Really? Okay.

    You're using g++ so I'm assuming you're on a terminal of some sort. Are you sure you're in the right directory then?

    If you're on Linux (and maybe this will work on Cygwin, Idk, I don't use Windows) but typing the command ls will display the content of the directory you're currently in. To change directories, use cd <directory name here>

    Use cd to get into the directory that contains Motto.cpp and confirm it's there by using ls.

  5. #5
    11DE784A SirPrattlepod's Avatar
    Join Date
    Aug 2013
    Posts
    485
    Quote Originally Posted by MutantJohn View Post
    Use cd to get into the directory that contains Motto.cpp and confirm it's there by using ls.
    And also confirm if the filesystem is case sensitive, and if it is that the source file is in fact called Motto.cpp and not motto.cpp

  6. #6
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Clearly, the OP is using Windows™, so case sensitivity should not be an issue. Anyway, as the error is telling you, it can't find the file you specified. Check if you are in the correct directory where the file resides, or specify a full path.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  7. #7
    11DE784A SirPrattlepod's Avatar
    Join Date
    Aug 2013
    Posts
    485
    Quote Originally Posted by Elysia View Post
    Clearly, the OP is using Windows™, so case sensitivity should not be an issue. Anyway, as the error is telling you, it can't find the file you specified. Check if you are in the correct directory where the file resides, or specify a full path.
    It's not clear at all. The OP said they typed exactly what the guidebook said to type. If you typed that in Linux, for example, you'd get exactly the same error message from g++.

  8. #8
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    OK, you're right. Seems I did not read that hard enough. The OP still says "command prompt," which implies Windows since Linux uses "terminal." But you're right. It is not enough to draw conclusions from.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Another Noob Problem
    By TheDeathryder in forum C++ Programming
    Replies: 5
    Last Post: 10-04-2012, 11:30 AM
  2. Big problem, but a noob to identify it!
    By lovenetuk in forum C Programming
    Replies: 3
    Last Post: 04-27-2011, 03:30 PM
  3. C++ Problem, I'm such a noob :d
    By Shamino in forum C++ Programming
    Replies: 1
    Last Post: 10-18-2005, 09:52 AM
  4. [noob] i can't even name the problem
    By knoxville in forum C Programming
    Replies: 19
    Last Post: 03-15-2005, 06:32 AM
  5. Any1 help with noob problem???
    By jr2007 in forum C++ Programming
    Replies: 3
    Last Post: 11-05-2003, 02:17 AM