Author Topic: Autocompletion and open #include not working on single file  (Read 5987 times)

Offline juraj

  • Single posting newcomer
  • *
  • Posts: 3
Autocompletion and open #include not working on single file
« on: December 14, 2011, 12:23:12 am »
Okay, I pretty much said the whole thing in the subject. If I open a single .cpp file (not a project) in Code::Blocks, I can compile and run it, but code completion and opening #included standard header files doesn't work. Opening fails with ""Warning: Not found: iostream" (for example). Can I set the standard c++ library directory to be searched globally, without the need for a project?

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 6035
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Autocompletion and open #include not working on single file
« Reply #1 on: December 14, 2011, 05:38:58 am »
Quote
If I open a single .cpp file (not a project) in Code::Blocks, I can compile and run it
Really? I don't think you can. Codeblocks need a project (cbp) to build and run.

Can you give us some information like: OS, C::B version, Or you code snippet, Compiler version....
Or tell us the steps to reproduce your bug.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7256
Re: Autocompletion and open #include not working on single file
« Reply #2 on: December 14, 2011, 08:55:09 am »
Quote
If I open a single .cpp file (not a project) in Code::Blocks, I can compile and run it
Really? I don't think you can. Codeblocks need a project (cbp) to build and run.

No you don't.
A single file is compile dwith the default compiler, just debugging does not work.

Offline juraj

  • Single posting newcomer
  • *
  • Posts: 3
Re: Autocompletion and open #include not working on single file
« Reply #3 on: December 14, 2011, 02:30:55 pm »
As Jens has already said, compiling and running does indeed work for single files. It's very useful for educational type programs, which are typically short but numerous and it would be an inconvenience to have to create a new project for each one. And it would be nice to have code completion, opening header files and debugging (as Jens noticed, and I agree) working for single files.

I am using the latest stable version. Steps to reproduce? Well, open a hello world .cpp and try to right click and open <iostream>. Also notice that code completion for standard library classes doesn't work, and that the debugging commands are grayed out.


Offline stahta01

  • Lives here!
  • ****
  • Posts: 7678
    • My Best Post
Re: Autocompletion and open #include not working on single file
« Reply #4 on: December 14, 2011, 04:59:17 pm »
I am using the latest stable version.

Why are there so many people who answer the version number question without giving a version number!!

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Autocompletion and open #include not working on single file
« Reply #5 on: December 14, 2011, 05:12:08 pm »
Because they think 10.05 is 'stable'  ;D

BTW. The new emoticons are pretty bad...
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline juraj

  • Single posting newcomer
  • *
  • Posts: 3
Re: Autocompletion and open #include not working on single file
« Reply #6 on: December 15, 2011, 08:45:38 am »
Why are there so many people who answer the version number question without giving a version number!!

Way to be polite and helpful.

BTW I'm using 10.05 if it's not already obvious.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9702
Re: Autocompletion and open #include not working on single file
« Reply #7 on: December 15, 2011, 09:21:37 am »
BTW. The new emoticons are pretty bad...
Hopefully you'll like the new ones...  ;)
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ