"No such file or directory".

0 Christopher Cullen · April 21, 2015
Hello everyone. 

I am currently going through Bucky's C++ videos and on video 49 (this). Here is the code I have written:

In the main.cpp window:

#include <iostream>
#include "chris.h"

int main(){

    Chris ChrisObj(7);

In the chris.h window:

#ifndef CHRIS_H
#define CHRIS_H

class Chris
        Chris(int );
        void printStuff();
        int C;

#endif // CHRIS_H

In the chris.cpp window:

#include <iostream>
#include "chris.h"

Chris::Chris(int num)

void Chris::printStuff(){
    std::cout << "C =" << C << std::endl;
    std::cout << "this -> C" << this -> C << std::endl;
    std::cout << "(*this).C =" << (*this).C << std::endl;

Unfortunately when I try to build and run the program I keep getting "No such file or directory" in the build messages window at the bottom of the screen. 

I have already tried creating a new project using the method described by Milo Lu in this link: http://stackoverflow.com/questions/21500724/c-undefined-reference-to-winmain16-codeblocks 

I was getting the "undefined reference to WinMain@16" when working through videos 46 and 47 on composition, which is why I referred to it. I'm not sure how relevant it is but the program in video 48 (friend) worked fine. 

Does anyone know why I am now getting the "No such file or directory" error and how to resolve the problem?

Many thanks.

Post a Reply


Oldest  Newest  Rating
0 Christopher Cullen · April 21, 2015
I'm currently using the GNU GCC 4.7.1 compiler. I've been looking around and found a mirror for the 4.9.2 version here: http://mirrors-uk.go-parts.com/gcc/releases/gcc-4.9.2/     I hope the link works. 

I've downloaded the tar.gz file and extracted the file onto my desktop so I now have 'gcc-4.9.2.tar' there. Am I right in thinking that this needs to go into the C:\Program Files (x86)\CodeBlocks\MinGW\bin directory?

Or do I need to download something from here instead: http://sourceforge.net/projects/mingw/files/ ?
0 Christopher Cullen · April 23, 2015
I've now downloaded the MinGW manager and installed it. Its current directory is C:\MinGW and I have told Code::Blocks to look here for the compiler's installation directory in Toolchain Excecutables under the global compiler settings. I now have version 4.8.1. 

The error report is shorter than it was previously so I think I'm making some headway, but the following error is still being returned (tutorial 49):

||=== Build: Debug in 20150423 (compiler: GNU GCC Compiler) ===|
 Cullen\Documents\Programming\Cpp\BuckyVideos\20150423\hannah.cpp -o obj\Debug\hannah.o||No such file or directory|
||=== Build failed: 1 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|

Although the 'hannah.o' file does not exist, I do not recall having the opportunity to create it anywhere in the tutorial so I'm not sure what to do here. Is this referring to the Hannah object (ho) in the tutorial?

Also, I keep my programming files inside their folder under My Documents. Could the space between 'My' and 'Documents' be causing problems even though it's just listing it as 'Documents' in the error report?
0 Christopher Cullen · April 24, 2015
I've since put the folder under the Local Disk directory and it works. 

Many thanks for the help.
  • 1



Used in many types of software including music players, video games, and many large scale applications.

Bucky Roberts Administrator