Wednesday, October 18, 2006

My adventurous day with C++*

Wednesday, October 18, 2006 9:39:34 PM (GMT Standard Time, UTC+00:00)

Today I had the rare 'pleasure' of dealing with some C++;. To start, the first thing I had to do was get a compiler. For this I ran to my usual engine and typed in "free c c++ compiler". The first hit said "Borland C++ Compiler version 5.5 Free Download Is Here !!!", to which I responded with a HUGE :D, as I used Borland compilers before in my undergrad yrs.

Sad to say however, to get that free 8.7MB product, released on 08/24/2000 it told me I had to register and fill out a form. Some of the required fields for this form were: first name, last name, telephone, address, city and country.  Now, I'm not one for giving out easy personaL info esp just for a quick dabble in C++, so I pushed the Back button a couple times and returned to my engine. After about 20mins, that too proved to be a waste.

I then found an old Visual C++ cd from MS lying around the place and installed that (this is version 1.52). That installed great and took about 155MBs (stupse) but I didn't care as I got my compiler! To test, I put in some code and click Build. Immediately I get an "iostream : No such file" error... again, "stupse!". So I rushed to claim back my hd space and get rid of that prog however, no uninstall file, not even from Add/Remove programs. By now, I'm not the happiest guy around as one can imagine!

FINALLY, something tells me to check VS 2005 and in the Project Types side-pane in the New Project window, there is the heading "Visual C++". :D <- he reappears here.

So I go to creat a new project but for some reason I've found it a bit difficult, it not as simple as I would have thought at all. Ways, for ones who just want to use VS 2005 to play around with standard Windows C++ (cpp) files follow the following steps (PS, of course this is under the pretense that you've installed Visual C++ component when you installed your version of VS 2005):

  1. File -> New Project
  2. Click Visual C++ heading in left pane and come down to Win32
  3. Click Win32 Console Application and in the bottom of the window enter the project name (yes, you should create a project first)
  4. In the Win32 Application Wizard window that pops up, Click on Application Settings link in the left pane and ensure the following are selected - Application type: Console application; Additional options: Empty project.
  5. Now, your project is created all you have to do is add the C++ files by Right Clicking on Project Name or relevant directory in Solutions Explorer and choosing the C++ File (.cpp) option in the Code category.
  6. Enter the name of your file and you should be sorted!

 

One last thing, remember in using C++ to include the "using namespace std;" to enable you to just put 'cout << "blah blah";' instead of 'std::cout << "blah blah";'. Oh and if you want VS 2005 C++ specific help, pop the string "visual studio 2005 c++" into your search and hopefully that gives you some good info. Usually a nice MS link should be up there with some samples and even a team blog. Enjoy!;

Related posts:
Select a random row in MS SQL...
Regular expressions
VS2005, ASP.NET 2 & DLLs, DLLs..
MS's ASP.NET and.. PHP
2-way databinding cascading drop down lists within a FormView
ApplicationName Property when customising providers

Thursday, October 19, 2006 7:43:40 PM (GMT Standard Time, UTC+00:00)
C++ or wha?

You reeeeeeeally need a job. Best try and call back E.Y.
A Man Like Bayne
Friday, October 20, 2006 2:07:35 PM (GMT Standard Time, UTC+00:00)
lol, oh shh boy. Sometimes you have to go back to your roots ie C and C++. You of all people should know that!
Jason Nurse
Comments are closed.