Back to basics; just started learnin C++
-
Hello, been using C# and vb.net and decided it's about time to make the leap to C++. I got a book recommended to me by a co worker entitled "Simple C++; learn C++ while you build the Incredible Robodog using POOP - The profound Object-Oriented Programming method" by Jeffrey M. Cogswell. I'm fine with this before I go onto something a little more detailed, and I have some pretty basic questions that a book written a decade ago just can't tackle. Firstly, a compiler. Which one do I use, I prefer something integrated with an IDE. Now I know VS has VC++, is this compiler only for C++.Net (which is managed I know, and I want to stay away from managed code for a bit). Recommendations, anything welcome.
-
Hello, been using C# and vb.net and decided it's about time to make the leap to C++. I got a book recommended to me by a co worker entitled "Simple C++; learn C++ while you build the Incredible Robodog using POOP - The profound Object-Oriented Programming method" by Jeffrey M. Cogswell. I'm fine with this before I go onto something a little more detailed, and I have some pretty basic questions that a book written a decade ago just can't tackle. Firstly, a compiler. Which one do I use, I prefer something integrated with an IDE. Now I know VS has VC++, is this compiler only for C++.Net (which is managed I know, and I want to stay away from managed code for a bit). Recommendations, anything welcome.
EliottA wrote:
is this compiler only for C++.Net
It can be used for unmanaged(only) code as well.
-
Hello, been using C# and vb.net and decided it's about time to make the leap to C++. I got a book recommended to me by a co worker entitled "Simple C++; learn C++ while you build the Incredible Robodog using POOP - The profound Object-Oriented Programming method" by Jeffrey M. Cogswell. I'm fine with this before I go onto something a little more detailed, and I have some pretty basic questions that a book written a decade ago just can't tackle. Firstly, a compiler. Which one do I use, I prefer something integrated with an IDE. Now I know VS has VC++, is this compiler only for C++.Net (which is managed I know, and I want to stay away from managed code for a bit). Recommendations, anything welcome.
Check here[^] Choose "win32" in the "project type" window then select "win32 Console application". Though you can still control the exe type through project settings. It's native by default. If you want to completely get out of dotnet environment, choose vc6.0 compiler that comes with Visual Studio 6.0 but the environment sucks. Intellisense fails too often. and less colorful ;)
OK,. what country just started work for the day ? The ASP.NET forum is flooded with retarded questions. -Christian Graus Best wishes to Rexx[^]
-
Check here[^] Choose "win32" in the "project type" window then select "win32 Console application". Though you can still control the exe type through project settings. It's native by default. If you want to completely get out of dotnet environment, choose vc6.0 compiler that comes with Visual Studio 6.0 but the environment sucks. Intellisense fails too often. and less colorful ;)
OK,. what country just started work for the day ? The ASP.NET forum is flooded with retarded questions. -Christian Graus Best wishes to Rexx[^]
The reason I ask is because I tried that, and the project came with some headers and I removed them all and created the typical first program
#Include <iostream.h>
void main
{
cout << "Hello, world";
}And It wouldn't compile citing "Error 1 fatal error C1010: unexpected end of file while looking for precompiled header. Did you forget to add '#include "stdafx.h"' to your source? c:\documents and settings\elaintabi\my documents\visual studio 2008\projects\helloworld\helloworld\helloworld.cpp 7 helloWorld" because I removed stdafx.h and the include, why do I need this file if in my book it doesn't include it in its sample?
-
The reason I ask is because I tried that, and the project came with some headers and I removed them all and created the typical first program
#Include <iostream.h>
void main
{
cout << "Hello, world";
}And It wouldn't compile citing "Error 1 fatal error C1010: unexpected end of file while looking for precompiled header. Did you forget to add '#include "stdafx.h"' to your source? c:\documents and settings\elaintabi\my documents\visual studio 2008\projects\helloworld\helloworld\helloworld.cpp 7 helloWorld" because I removed stdafx.h and the include, why do I need this file if in my book it doesn't include it in its sample?
this is because you might have started a project from a template or something. just deactivate the
precompiled headers
in the compiler settings to have this error disappeard. BTW, be careful. #include is with a smalli
, not#**I**nclude
. Moreover, you should prefer using iostream (without .h) header. also, you code won't work for some other reasons. cout won't be found in the global namespace. just prepend it withstd::
. and main is a function, so you have to give it a pair or parenthesis:#include <iostream>
void main() {
std::cout << "Hello World !";
}[VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]
-
this is because you might have started a project from a template or something. just deactivate the
precompiled headers
in the compiler settings to have this error disappeard. BTW, be careful. #include is with a smalli
, not#**I**nclude
. Moreover, you should prefer using iostream (without .h) header. also, you code won't work for some other reasons. cout won't be found in the global namespace. just prepend it withstd::
. and main is a function, so you have to give it a pair or parenthesis:#include <iostream>
void main() {
std::cout << "Hello World !";
}[VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]
-
Got it, thanks, I had to use #include "iostream" and fully qualify cout using std::cout, which is slightly annoying but it work sso i feel better about it hahah
EliottA wrote:
fully qualify cout using std::cout, which is slightly annoying
well beginners often fell std:: namespace annoying, but when going further in the experience, you kinda love it :-D In fact, you could declare a
using namespace std;
befoire themain()
call and use onlycout
, but it's prefered to have the namespace prepended (and "std
" is not what i'd call a loooooong name ;) )[VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]
-
EliottA wrote:
fully qualify cout using std::cout, which is slightly annoying
well beginners often fell std:: namespace annoying, but when going further in the experience, you kinda love it :-D In fact, you could declare a
using namespace std;
befoire themain()
call and use onlycout
, but it's prefered to have the namespace prepended (and "std
" is not what i'd call a loooooong name ;) )[VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]
-
Book didn't specify that, but google did. TY for the help, 5's all around.
Also did you get the precomplied header error?That's a technique VC++ applies to keep people away from it. LOL! it gives that stupid pch error on compilation and discourages people. Dont get deceived by it.. :). Also when you choose the project type next time, you may select "Add common headers-MFC" radio that you will find on the right side when are going through the project wizard. That sets up namespace for stl & required headers for MFC, in case you'd want to test MFC classes too. Good luck ;)
OK,. what country just started work for the day ? The ASP.NET forum is flooded with retarded questions. -Christian Graus Best wishes to Rexx[^]
-
Also did you get the precomplied header error?That's a technique VC++ applies to keep people away from it. LOL! it gives that stupid pch error on compilation and discourages people. Dont get deceived by it.. :). Also when you choose the project type next time, you may select "Add common headers-MFC" radio that you will find on the right side when are going through the project wizard. That sets up namespace for stl & required headers for MFC, in case you'd want to test MFC classes too. Good luck ;)
OK,. what country just started work for the day ? The ASP.NET forum is flooded with retarded questions. -Christian Graus Best wishes to Rexx[^]
-
right now, I'm just trying to code a dog. :laugh:
EliottA wrote:
right now, I'm just trying to code a dog.
Then I'd suggest VB. You dont need to code. It's already there. it's just that.
OK,. what country just started work for the day ? The ASP.NET forum is flooded with retarded questions. -Christian Graus Best wishes to Rexx[^]