Hello Guest, please login or register.
Did you miss your activation email?
Login with username, password and session length.

Pages: [1]   Go Down

Author Topic: [Request / Solved] A bit of C++ Help  (Read 2855 times)

0 Members and 1 Guest are viewing this topic.
[Request / Solved] A bit of C++ Help
« on: April 15, 2006, 08:17:00 am »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 222
Lately I've been working on C++ and have gotten ok with it.  Right now I'm working on a program that will calculate the Volume of a Rectangular Prism, Cylinder and Pyramid using functions.  Everything seems to run well exept when I compile it, it gives me this error message.

Quote
38 | C:\Documents and Settings\Owner\My Documents\C++\project\VolumeType.cpp:14 | funcCubeVolume.cpp: No such file or directory.

On line 38 is this piece of code.

Code: [Select]
#include <funcCubeVolume.cpp>
I can't quite figure it out.  Also, this pic may or may not help.

http://img.photobucket.com/albums/v198/DarkLink6235/Misc/chelp.png

Help is appreciated.  If you need more information, just ask for it.
« Last Edit: February 24, 2012, 12:27:07 pm by Niek »
Logged

under the alias DarkLink6235

Ben

Re: A bit of C++ Help
« Reply #1 on: April 15, 2006, 10:48:23 am »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Posts: 437
Why are you including .cpps?
I was always told never to and you don't need it anyway as Dev-C++ compiles them all and then sticks them all into one executable.
The idea is that you have a header with the function definition ie:
Code: [Select]
double cuboidVolume(double a, double b, doublec);

And then you include that in both the cuboidVolume.cpp and main.cpp, and as long as you have inclusion guards on it (I assume you know how to do that). It will compile fine.
Logged
Want a place to upload your sprites and games for FREE? Look no further than GameDevotion
Re: A bit of C++ Help
« Reply #2 on: April 24, 2006, 08:02:09 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 26
I don't see why you would include a .cpp file either...
but...
Code: [Select]
#include "funcCubeVolume.cpp" ?
Logged
Re: A bit of C++ Help
« Reply #3 on: April 24, 2006, 08:25:34 pm »
  • *
  • Reputation: +3/-0
  • Offline Offline
  • Gender: Male
  • Posts: 6629
As said above, you really should create a header file, including cpp files is a really bad idea <_<. Also you shouldnt use the <> tokens when including a local source file you should use "" (<> looks for files in the windows folder, such as Windows.h, GL\OpenGL.h...etc)
Logged
Re: A bit of C++ Help
« Reply #4 on: April 25, 2006, 02:28:57 am »
  • *
  • Reputation: +1/-0
  • Offline Offline
  • Gender: Male
  • Posts: 4588
Always use header files, always use quotation marks.

Custom:

#include "bmpRun.h"

Predefined with Windows:

#include <windows.h>
Logged
the a o d c
Re: A bit of C++ Help
« Reply #5 on: April 26, 2006, 05:10:07 am »
  • The Broken King
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 1259
Just a note in general though, if you get a case like this again (where it says it can't find a file that DOES exist), and it isn't because of the .cpp or <> as opposed to "" thing, if you go build -> rebuild solution, it relinks the files if they somehow got de-linked. Or, deleting your debug folder sometimes does the trick too. (These wouldn't work in this case prolly, but they work in similar cases.)
Logged
  • Broken Kings [Temp Site]
Re: A bit of C++ Help
« Reply #6 on: April 26, 2006, 09:37:48 pm »
  • Doesn't afraid of anything
  • *
  • Reputation: +42/-0
  • Offline Offline
  • Gender: Male
  • Posts: 7002
yea, common mistake I think with newer people (i've done it  A LOT in the past few months).  Just don't use #include on cpp files.
Logged



i love big weenies and i cannot lie
Pages: [1]   Go Up

 


Contact Us | Legal | Advertise Here
2013 © ZFGC, All Rights Reserved



Page created in 0.04 seconds with 48 queries.