Author Topic: save as c++ file?  (Read 26763 times)

Offline jinjin12

  • Multiple posting newcomer
  • *
  • Posts: 13
save as c++ file?
« on: September 17, 2011, 06:00:54 am »
ok so i was typing in some c++ source code and i saved the source code as a "c/c++ file" but when i tried to compile it, i got an error saying something like "iostream not found".  i found found the problem was that when i saved the source code, it was saved as a .c and not a .cpp file.  i had to rename it to a .cpp for it to work.  now my question is how do i make it save as a .cpp and not as a .c file everytime i save a file and selecting the file type as "c/c++ file"???? this is very annoying

Offline Alpha

  • Developer
  • Lives here!
  • *****
  • Posts: 1513
Re: save as c++ file?
« Reply #1 on: September 17, 2011, 03:46:05 pm »
If I understand you correctly, you are working with an individual file created by New->Empty file.  What you want to do is use the file wizard (New->File...), select C/C++ source, click Go, and follow the wizard's instructions (selecting C++ when given the option).

The other thing you may want to consider (that is, if you have not already) is to use a Code::Blocks project to manage everything.

Offline jens

  • Administrator
  • Lives here!
  • *****
  • Posts: 7265
    • Jens' unofficial debian-repository for the Code::Blocks - IDE
Re: save as c++ file?
« Reply #2 on: September 17, 2011, 05:03:52 pm »
Give the full name (includig the cpp).

Offline jinjin12

  • Multiple posting newcomer
  • *
  • Posts: 13
Re: save as c++ file?
« Reply #3 on: September 17, 2011, 07:20:39 pm »
If I understand you correctly, you are working with an individual file created by New->Empty file.  What you want to do is use the file wizard (New->File...), select C/C++ source, click Go, and follow the wizard's instructions (selecting C++ when given the option).

The other thing you may want to consider (that is, if you have not already) is to use a Code::Blocks project to manage everything.

yea i'm doing new _> empty file.  i'll try this later but from what i'm reading, it seems to much work to go through a wizard everytime when i can just type in .cpp myself.  unless you just have to go through this wizard once and it will automatically put .cpp everytime afterwards?
Give the full name (includig the cpp).
yea that's what i've been doing lol.  typing in the .cpp when saving.  but im saying, if i'm choose to save as "c/c++ file" and i have c++ libraries in my source, then it should auto save .cpp without me having to type it.  i just find it annoying.  wxdevc++ did this automatically. i don't know maybe i am just nitpicking, i think i have OCD, little things annoy me.  but other than that, i find code blocks to be a very good IDE, much better than wxdev.  i just started using it and i love that it tells you how long your program takes to compile and run and also i like that it pauses the output window for you.  in wxdev you have to add garbage code at the end just to do that.

still no IDE, imho is better than just using a text editor like gedit or Emacs on linux :D. the Unix terminal is very powerful

Offline Rai

  • Single posting newcomer
  • *
  • Posts: 6
Re: save as c++ file?
« Reply #4 on: September 17, 2011, 10:34:46 pm »
still no IDE, imho is better than just using a text editor like gedit or Emacs on linux :D. the Unix terminal is very powerful

Yeah, i was using nano till i had to write MAN for project containing more than 10 files... since then, i am happily using IDE's...

Offline Alpha

  • Developer
  • Lives here!
  • *****
  • Posts: 1513
Re: save as c++ file?
« Reply #5 on: September 18, 2011, 12:28:51 am »
... it seems to much work to go through a wizard everytime when i can just type in .cpp myself.  unless you just have to go through this wizard once and it will automatically put .cpp everytime afterwards?
I guess I never thought about the time; basically what the wizard does is acquire the filename and what build targets it belongs to (when using a project) - all steps that would have to be done eventually.
The wizard will default to previous selections; to get everything done automatically, I think there might have been a way to set up a shortcut (I cannot remember what).