Thread: rect.h

  1. #1
    Novice Programmer Pyroteh's Avatar
    Join Date
    Jan 2005
    Location
    Alaska
    Posts
    82

    Question rect.h

    whenever I compile this program,

    Code:
    #include "rect.h"
    SimpleWindow W("Main Window", 8.0, 8.0);
    int ApiMain() {
    	W.Open();
    	RectangleShape R(W, 4.0, 4.0, Blue, 2.0, 3.0);
    	R.Draw();
    	return 0;
    }
    my compiler displays this
    "cannot open include file: 'rect.h': no such file or directory"

    how do I fix it?

  2. #2
    Registered User
    Join Date
    Aug 2003
    Posts
    1,218
    By telling us what compiler and what ide you are using. Some IDEs require that you add every file you wish to include (that are not in the compilers standard search directories) to a project or similar.

  3. #3
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,708
    >> "cannot open include file: 'rect.h': no such file or directory"

    put rect.h in the program's directory (and put quotes around the include statement) or in a directory included in your compiler's %PATH%. also, if rect.h's code is declared in a separate namespace remember to either import the namespace (or components) or declare your code in the same namespace.
    Code:
    #include <cmath>
    #include <complex>
    bool euler_flip(bool value)
    {
        return std::pow
        (
            std::complex<float>(std::exp(1.0)), 
            std::complex<float>(0, 1) 
            * std::complex<float>(std::atan(1.0)
            *(1 << (value + 2)))
        ).real() < 0;
    }

  4. #4
    Novice Programmer Pyroteh's Avatar
    Join Date
    Jan 2005
    Location
    Alaska
    Posts
    82
    I'm using micosoft visua C++ 6.0

    how do I find out what IDE I'm using?

  5. #5
    Registered User
    Join Date
    Aug 2003
    Posts
    1,218
    you using visual studio 6 IDE. You need to have the file added to your project in order for the compiler to find it.

  6. #6
    Novice Programmer Pyroteh's Avatar
    Join Date
    Jan 2005
    Location
    Alaska
    Posts
    82
    ok I added the file to my project but... 8 errors came up

    error LNK2001: unresolved external symbol "public: __thiscall SimpleWindow::SimpleWindow(char const *,float,float,class Position const &)" (??0SimpleWindow@@QAE@PBDMMABVPosition@@@Z)

    this is only the first one....

  7. #7
    Novice Programmer Pyroteh's Avatar
    Join Date
    Jan 2005
    Location
    Alaska
    Posts
    82
    ok I ran the program again after adding the file "rect.h" to the project files and another error came up....

    "unexpected end of file while looking for precompiled header directive"

    thanks for any help given....

  8. #8
    UT2004 Addict Kleid-0's Avatar
    Join Date
    Dec 2004
    Posts
    656
    Make sure when you make a new project, that you click on the Empty option, and then add to your program by going to the solution explorer, right-clicking, and adding files there. Make sure you put your new project in a place where you can see it, like the desktop.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. The great mystery
    By mfc2themax in forum A Brief History of Cprogramming.com
    Replies: 39
    Last Post: 08-15-2001, 08:08 PM