• 0

[C++] - Help with Microsoft Visual C++ '08 Express Edition


Question

Hi everyone.

I've been posting somewhat more frequently again today, but this time I have a different question altogether.

I've been working on trying to use the #include "header.h" functions again today, to see if I could get things working with some class header information.

I made a simple test run that works when I compile everything in Dev-C++, but not at all in MVC++EE2008.

All I did was:

1. Made a header file for functions like add(int a, int b) and subtract(int a, int b).

2. Made the cpp file containing the function's definitions.

3. Made a main file that made use of those functions.

4. Compiled it all up, and it ran well.

This of course was in Dev-C++.

When I try to do something like this with MVC++EE2008, I get an error saying that the boot log cannot be found or something.

It's really quite annoying because I want to be able to use MVC++EE2008 but it just isn't working out for me.

Also, when I try to open a CPP file from say my desktop (something pre-written) the ability to debug "grays out".

On top of that, I'm not sure if there should be one or not but, I can't seem to use a "compile" action (like CTRL + Shift + f7).

Am I supposed to put headers in the header folder on a project in MVC++EE2008 and CPP function definitions in the resources folder, and main in sources?

Would that not dissolve the usefulness of having your function definitions in separate files where they cannot be seen or accessed?

Could someone give me a pointer here on how this IDE is supposed to work, if I might be better using something like Code::Blocks, or what?

I've been working on all this all day to no avail, so I'm really open to just about any valid support.

Thanks.

Link to comment
Share on other sites

6 answers to this question

Recommended Posts

  • 0

Visual Studio works with projects. You can't open a file and just try to compile it or debug it like that.

Always create a General -> Empty project (not Win32, not Console). Add files by right-clicking the project and selecting Add -> New Item. They will automatically be put in the right filter (headers go in "Header" and sources go in "Sources". Leave "Ressources" alone).

There's no "usefulness" to the separation between header and source files besides making it easier to implement a compiler. Most languages by far do not use this clumsy model. In D, Java, C#, Python, etc., there are only source files.

Edited by Dr_Asik
Link to comment
Share on other sites

  • 0
There's no "usefulness" to the separation between header and source files besides making it easier to implement a compiler. Most languages by far do not use this clumsy model. In D, Java, C#, Python, etc., there are only source files.

My understanding was that it was a primitive form of encapsulation.

Link to comment
Share on other sites

  • 0
My understanding was that it was a primitive form of encapsulation.

That's what I was lead to believe as well.

Much like using inclusion to add class information etc... into a source file, using inclusion on functions was supposed to be a limited example of encapsulating "private" information that you do not want changed by other programmers.

Now, this doesn't necessarily apply to me at this point in time as I am working alone, and just learning the language, but I felt it necessary to grasp an understanding of some forms of encapsulation so that, for example, I could use it in larger projects, should I end up doing something as such in the near future.

Correct me if I'm wrong.

Link to comment
Share on other sites

  • 0

#include is a preprocessor directive that literally copy-pastes the included file into the file including it so that the compiler sees everything it needs to compile this source file in complete separation of every other source file. Header files exist so that not all the code needs to be recompiled for every source file, only new source code and existing declarations. Hence, header files should typically not contain any source code except very short functions (like getters and setters). But they can very well do, and in the case of templates, all the source code is literally in the header. Look at the STL, vector.h etc. All the source is there, directly in headers. It's impossible to publish it as a .lib or .dll, you have to publish your source code.

This is NOT encapsulation. It's a broken, clumsy compilation model. C++ has approximately no encapsulation of anything and is not in general a very good example of an object-oriented language. It allows you to do something like OOP while keeping excellent compatibility with C and control of memory.

The canonical example of OOP is Java. It's object-oriented to the point of being dogmatic. :p

Edited by Dr_Asik
Link to comment
Share on other sites

  • 0
The canonical example of OOP is Java. It's object-oriented to the point of being dogmatic. :p

Actually Java isn't the best example. It's not a pure OOP language. The canonical example of OOP would infact be Smalltalk.

Java is not because it supports primitive datatypes such as int, byte, long, etc. These are not objects.

Contrast with a pure OOP language like Smalltalk, where there are no primitive types, and boolean, int and methods are all objects.

I think Ruby is also a pure OOP language as well.

Edited by Xilo
Link to comment
Share on other sites

  • 0

Sure, but Smalltalk is dead. I was talking about the most popular languages.

Yeah in Java some types are not objects but that's more of a quirk (introduced for performance reasons) than anything else. Compare with C# where everything is an object including int, double, etc., but C# has language-level support for functional programming, event-based programming, better support for generic programming, etc. Java is the only mainstream language I know of that pretty much only supports OOP.

I hear that Ruby has good support for functional programming. http://stackoverflow.com/questions/159797/...tional-language

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.