Author Topic: #include <iostream> NO such File or Directory  (Read 295852 times)

Offline monsto

  • Single posting newcomer
  • *
  • Posts: 5
Re: #include <iostream> NO such File or Directory
« Reply #30 on: June 04, 2010, 11:12:29 pm »
anything. i started by trying to make it something relevant to what i was doing (lesson, learn1, learncpp, etc) but eventually i gave up and settled for the suggested Untitled12

Offline jens

  • Administrator
  • Lives here!
  • *****
  • Posts: 7265
    • Jens' unofficial debian-repository for the Code::Blocks - IDE
Re: #include <iostream> NO such File or Directory
« Reply #31 on: June 04, 2010, 11:27:04 pm »
The ending has to be cpp or cxx, to make the compiler detect it as c++-file.

Offline monsto

  • Single posting newcomer
  • *
  • Posts: 5
Re: #include <iostream> NO such File or Directory
« Reply #32 on: June 04, 2010, 11:34:06 pm »
great. thanks.

1) in the scenario above, how would that be accomplished? do i need to choose a different new file type or just rename the file?

2) how would a person new to c++ find how to have the ide run as what tutorials expect to be default behaviour?


Offline jens

  • Administrator
  • Lives here!
  • *****
  • Posts: 7265
    • Jens' unofficial debian-repository for the Code::Blocks - IDE
Re: #include <iostream> NO such File or Directory
« Reply #33 on: June 04, 2010, 11:41:27 pm »
You can rename it, but you might have to close and reopen the project.

If you are new to c++, you should buy you a good book or find a good online-tutorial or forum.

This forum is not dedicated to teaching beginners how to program or how to use a compiler.

Without basic knowledge you will have problems with almost every IDE.

Offline monsto

  • Single posting newcomer
  • *
  • Posts: 5
Re: #include <iostream> NO such File or Directory
« Reply #34 on: June 04, 2010, 11:53:20 pm »
i have done that.

the tutorials on learncpp.com nor the examples in sams "c++ in 24hrs" had expectation issues with the other couple of ide's i tried after encountering this... Dev-C++ for example.

it's not my lack of c++ knowledge that is at issue, it's the expected default behaiviour of codeblocks. It is unexpected that i'd need to rename a file during the "open new file" process.
« Last Edit: June 04, 2010, 11:55:31 pm by monsto »

Offline monsto

  • Single posting newcomer
  • *
  • Posts: 5
Re: #include <iostream> NO such File or Directory
« Reply #35 on: June 05, 2010, 01:07:14 am »
after jackin around with it for a while, here's the solution for the problem in the OP for codeblocks 10.05

  • If you've previously installed a compiler, check the windows path statement for erroneous compiler paths. (if you don't know how, use a search engine)
  • Check Settings > Compiler and debugger > Global compiler settings > Toolchain executables and verify that Compiler's installation directory is using the compiler you want it to use. if you installed MinGW with CodeBlocks, it should reflect as much. (your dirs may be diff from mine, thus no example)
  • File > New > File...
  • Choose C/C++ source
  • Choose C++
  • Name and locate your file.
  • Check Add file to active project
  • Click All
  • Click Finish

You should now have a file in which you can paste source from a tutorial and it should compile as expected.

Offline Leron

  • Single posting newcomer
  • *
  • Posts: 5
Re: #include <iostream> NO such File or Directory
« Reply #36 on: August 23, 2010, 01:24:05 am »
Similar problem here. I have project generated by cmake which fails to build with same message. Codeblocks sees the file and i can include it in other projects. I unchecked "this is custom makefile" in the generated project properties but no effect. I am using TDM-GCC 32 on XP x64, CB 10.05

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9508
Re: #include <iostream> NO such File or Directory
« Reply #37 on: August 23, 2010, 06:58:52 am »
I have project generated by cmake which fails to build with same message.
C::B projects done with CMake are based on Makefiles. That's probably not what you want and IMHO a serious limitation of CMake. Try to convert the project top use C::B's build system instead.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: http://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: http://wiki.codeblocks.org/index.php?title=FAQ

Offline Leron

  • Single posting newcomer
  • *
  • Posts: 5
Re: #include <iostream> NO such File or Directory
« Reply #38 on: August 23, 2010, 08:29:05 pm »
Quote
Try to convert the project top use C::B's build system instead.

How can i do it? Is it possible to turn off using makefiles in code:blocks?

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9508
Re: #include <iostream> NO such File or Directory
« Reply #39 on: August 23, 2010, 08:37:53 pm »
How can i do it?
Inspect what CMake actually creates, probably turn on verbose build and then transfer the settings into C::B.

Is it possible to turn off using makefiles in code:blocks?
I don't quite get the question... C::B has two build systems: A native (fast) one and a one based on Makefiles. The latter is for convenience and the latter is what CMake will create. Ask the authors of CMake for support of C::B's native build system. Surely Makefiles cannot be converted "just as is" to a native C::B project. But again: If the Makefile based build works and you don't need the special features that come with the native build system of C::B (e.g. scripting) you can leave it as it is and that would be just fine and supported by C::B, too.

So neither there is a "turning off" in C::B, nor this is a limitation of C::B.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: http://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: http://wiki.codeblocks.org/index.php?title=FAQ

Offline Leron

  • Single posting newcomer
  • *
  • Posts: 5
Re: #include <iostream> NO such File or Directory
« Reply #40 on: August 25, 2010, 10:05:12 pm »
Well, neither i get what you meant. cmake generated .cbp file, i opened it. Are you saying that now i can't control what directories compiler will search for headers?

Online stahta01

  • Lives here!
  • ****
  • Posts: 6672
    • My Best Post
Re: #include <iostream> NO such File or Directory
« Reply #41 on: August 26, 2010, 01:15:22 am »
Well, neither i get what you meant. cmake generated .cbp file, i opened it. Are you saying that now i can't control what directories compiler will search for headers?

No, we are saying you need to learn to use the Makefile system to do that fix.

Or, convert your program to use the Code::Blocks native build system; this may be simple to very hard to do, Depending on the complexity and size of your application/library.

Note: I suggest reading what options can be passed to make command using the makefile to solve this problem and after finding the options; ask where in Code::Blocks the make options can be placed.

Edit: What I personally would do would be to create an new makefile that uses the CMake generated top makefile and inside my new makefile I would do all the changes needed to fix problems like you are having. But, this requires knowing how to write simple to moderately complex makefiles.  I would then change C::B to use my new makefile.

Tim S.


« Last Edit: August 26, 2010, 01:20:08 am by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline Leron

  • Single posting newcomer
  • *
  • Posts: 5
Re: #include <iostream> NO such File or Directory
« Reply #42 on: August 26, 2010, 04:08:47 pm »
Well, cmake is able to generate VC++ projects, i guess on windows that would be fine.

Offline jayushkin

  • Single posting newcomer
  • *
  • Posts: 2
Re: #include <iostream> NO such File or Directory
« Reply #43 on: September 22, 2010, 11:03:14 am »
hello there i am new to c++

i have tryed to compile this program but it says

#include <iostream> NO such File or Directory

was just wondering y as some of my programs work right but some do this

#include <iostream>
using namespace std

main()
{
    cout << "hello there Does this program work"  << endl;
    cout << "check it a new line"  << endl;
    return(0);
}

any help would be apprecated greatly thx

I had the same problem.  I managed to fix the file not found problem by adding CodeBlocks/MinGW/lib/gcc/mingw32/4.4.1/include/c++ but I am still getting "cout" not resolved.

Quote
C:\Users\jay\Documents\mmorpg\helloworld.cpp||In function 'int main()':|
C:\Users\jay\Documents\mmorpg\helloworld.cpp|5|error: 'cout' was not declared in this scope|
||=== Build finished: 1 errors, 0 warnings ===|

I don't understand why CodeBlocks should not set its own search paths properly when it gets installed.  Hopefully the remaining problem will yield to the same approach, otherwise I'm out of ideas.

Offline jens

  • Administrator
  • Lives here!
  • *****
  • Posts: 7265
    • Jens' unofficial debian-repository for the Code::Blocks - IDE
Re: #include <iostream> NO such File or Directory
« Reply #44 on: September 22, 2010, 11:19:18 am »
I don't understand why CodeBlocks should not set its own search paths properly when it gets installed.  Hopefully the remaining problem will yield to the same approach, otherwise I'm out of ideas.

Code::Blocks is an IDE, not a compiler, so it don't need to set searchpaths.
Normally the compiler finds his libs and headers without explicitely setting a searchpath.
If not, something is wrong with either your setup and/or yur compiler !