Simple tutorial for C++

twinbaby

Supremacy Member
Joined
Jul 8, 2014
Messages
5,470
Reaction score
1,534
which means C++ lose it popularity to other language already?due to mainly use to windows 8?
 
Last edited:

ykgoh

Master Member
Joined
Jan 1, 2000
Messages
2,782
Reaction score
0
still the same.

.->on dialog->no member found for intellisense

Troubleshooting IntelliSense in C++ Projects

IntelliSense Limitations

IntelliSense does not work in C++ projects under the following circumstances:
  • The project is a C++/CLI project. :eek:
  • The cursor is in a code comment.
  • You are writing a string literal.
  • A syntax error appears over the cursor.
  • The solution consists of either the syntax for managed C++, or the earlier Managed Extensions for C++ syntax.
  • IntelliSense is not fully supported when you reference a header file multiple times by using the #include directive, and the meaning of that header file changes because of various macro states that are defined through the #define directive. In other words, when you include a header file several times and the header usage changes under different macro states, IntelliSense does not always work.
 

davidktw

Arch-Supremacy Member
Joined
Apr 15, 2010
Messages
13,550
Reaction score
1,302
which means C++ lose it popularity to other language already?due to mainly use to windows 8?

Please don't just live in the Windows world. C++ is still one of the most manipulative language today in the Industry, used by tons of programmers, especially those in the gaming, engineering industry. It is also widely used in the Unix arena.

While in comparison to C, C++ is not one of the fastest, it still have its market share among programmers.
 

ykgoh

Master Member
Joined
Jan 1, 2000
Messages
2,782
Reaction score
0
which means C++ lose it popularity to other language already?due to mainly use to windows 8?

I don't know and would not like to speculate.

On Unix/Linux, it is still the major programming language.

On MacOS, Objective-C is the one.

On Windows, maybe Microsoft is pushing developers to C# or other managed languages. There is a Managed C variant for .NET. But given that so much codes are all written in C/C++ even in Windows itself, C/C++ will continue to stay on, at least for the next 10 years.
 

davidktw

Arch-Supremacy Member
Joined
Apr 15, 2010
Messages
13,550
Reaction score
1,302
What's the problem with programmers nowadays ? Don't know something called Reference Guide ? Even for Java, there is a JDK reference guide, is all these autocomplete convenience now the gold standard to looking up for methods and class and function names in the SDK? (Facepalm)

Do you mean just by having these autocomplete and auto fill up features in the IDE makes you a good programmer and know exactly the rules to using the method or how to use them properly ? (Facepalm - again)

Java
http://docs.oracle.com/javase/7/docs/api/index.html

C++
http://www.cplusplus.com/reference/

How programmers does programming before the existent of Internet. (Google it ?)
 
Last edited:

twinbaby

Supremacy Member
Joined
Jul 8, 2014
Messages
5,470
Reaction score
1,534
Now I know that C can be used for do web programming.

-snip-
On Windows, maybe Microsoft is pushing developers to C# or other managed languages. There is a Managed C variant for .NET. But given that so much codes are all written in C/C++ even in Windows itself -snip-.

With regards to #26,If I am using notepad++,good thing is there is color coding and (new tab)->can open up another space.It also run faster.Cons is it doesn't tell me what error I made,I need to go to Console->Right Click and copy down the error message and search how to resolve.

For IDE I can use F5(Build Project) , F7(Run Project) and save the solution,
it also tell me what mistake I made in advance.
 
Last edited:

davidktw

Arch-Supremacy Member
Joined
Apr 15, 2010
Messages
13,550
Reaction score
1,302
Now I know that C can be used for do web programming.

发现新大陆 :)

Code:
#include <stdio.h>

int main(int argv, char **argc) {
  printf("Content-Type: text/plain\n\nHello World\n");
  return 0;
}

Compile this and put into your web server.

Note: Any programming language or tool that can do STDIN and STDOUT can be used for web programming
 
Last edited:

twinbaby

Supremacy Member
Joined
Jul 8, 2014
Messages
5,470
Reaction score
1,534
Hi YkGoh,DavidKtw

Regarding work.

When the Helpdesk Agent is on leave on MC.Or the company has got no Helpdesk agent for the application due to turnover.Who is going to do the application support.

The obvious choice is the programmer,because he knows the inside out of the application.Hence the boss will assign him to do the job instead.He has to code and answer email and call at the same time when things goes wrong.
 

davidktw

Arch-Supremacy Member
Joined
Apr 15, 2010
Messages
13,550
Reaction score
1,302
Hi YkGoh,DavidKtw

Regarding work.

When the Helpdesk Agent is on leave on MC.Or the company has got no Helpdesk agent for the application due to turnover.Who is going to do the application support.

The obvious choice is the programmer,because he knows the inside out of the application.Hence the boss will assign him to do the job instead.He has to code and answer email and call at the same time when things goes wrong.

Dear twinbaby,

I have been in the same position as you are years back. Your statement made is that the helpdesk is not available for awhile and you have to do the backup. My answer for you is during my time, there is no help desk for me.

I was the developer, the operator, I answered the calls and the emails. I went down to the data centre to install the servers and install the operating system and the application during backup. I went overseas to help clients upgrade their servers.

So what is your point in this whole statement ?
 
Last edited:

twinbaby

Supremacy Member
Joined
Jul 8, 2014
Messages
5,470
Reaction score
1,534
true.

years ago.I multitask as well.network engineer,electrical drafter,web designer,sales assistant,programmer->engineer assistant just after i finish poly.

Unlike big company the job scope is quite fix one.
 

davidktw

Arch-Supremacy Member
Joined
Apr 15, 2010
Messages
13,550
Reaction score
1,302
true.

years ago.I multitask as well.network engineer,electrical drafter,web designer,sales assistant,programmer->engineer assistant just after i finish poly.

Unlike big company the job scope is quite fix one.

So what's your point ? I still see no point in your statement. That you are a very capable person that can handle multiple roles ?

Indeed MNC has fixed role. Software developer there don't even know what is inside a rack server. They don't even know what is a remote management component. They don't know how to setup a H/W RAID in the data centre. They don't know how to install a full fledge virtual machine cluster, neither do they know anything about Redhat clustering, which kind of hardware is required, how to do STONITH. I bet they don't even know how much AMP is required to run the servers and how to tie the cables in the rack, how to position the servers so that the rack will not topple. How about what is a rack stabiliser ? How about which U in the rack is the KVM normally placed ?

Do you think working in a large MNC gives you access to all these skill sets ? Go and have a good thought about all these.

Take up each role while you are young and make them challenges. Be positive about all these are they will make you who you are in the future. I will believe all these skill sets that I'm equipped with today will not be there if I'm not even given the opportunity to take up the roles. Be fortunate you are tasked with multiple roles. If you can't cope with them, voice out. If you feel you are taken granted for, then move on.
 
Last edited:

ykgoh

Master Member
Joined
Jan 1, 2000
Messages
2,782
Reaction score
0
that means I need to rename as .c project.:eek:

OK, a long article from Microsoft explaining why Visua Studio 2010 does not support C++/CLI (Common Language Infrastructure). See: C++/CLI IntelliSense in Visual Studio vNext - Visual C++ Team Blog - Site Home - MSDN Blogs

You can try 2 things:

  1. Create a Win32 Console Application project, not CLR Console Application project.
  2. Upgrade to VS2012 or later with full Intellisense support for C++/CLI.

01.png

I think all your grief is due to an IDE that has broken Intellisense, and you might have unknowingly created a CLR Console Project instead. Please verify your project type is Win32 Console Application.

This is what Microsoft gets when it spins off a variant of C++ for managed codes. Now when we talk about C++ under Windows, we have to ask whether it is the pure Win32 native C++ or the CLR managed variant (C++/CLI). :vijayadmin::vijayadmin::vijayadmin:
 

twinbaby

Supremacy Member
Joined
Jul 8, 2014
Messages
5,470
Reaction score
1,534
seems better now.when I just type the variable i declare it prompts me with options.

jahpa0.png


How come Win32 got so many header file like stdafx.h,targetver.h.
 

ykgoh

Master Member
Joined
Jan 1, 2000
Messages
2,782
Reaction score
0
seems better now.when I just type the variable i declare it prompts me with options.

So your fix is to use VS2012 instead of VS2010? And the Intellisense works?

How come Win32 got so many header file like stdafx.h,targetver.h.

See: What's the use for "stdafx.h" in Visual Studio? - Stack Overflow

It's Microsoft's proprietary (non-standard) way of using pre-compiled header to speed up compilation/build. Obviously, if you intend to code cross-platform C++ codes that may be compiled by other compilers (e.g. GNU C Compiler), it's wise to start an Empty Project under Win32. This is one reason why I absolutely hate Win32 C++ programming: Microsoft likes to do things their way, and force you to follow it.

Some of the things Microsoft does to C++:
  • Proprietary macros only available in Microsoft Visual C++ header files
  • Proprietary pragmas understood only by Visual C++ preprocessor but indecipherable to others
  • Proprietary libraries and headers specific to the Windows platform (Windows SDK)

You take the bunch of C++ source code files and try building on Unix/Linux using GCC. Good luck trying to make it build and link. The whole damn thing won't build without Microsoft Visual C++, spewing pages and pages of errors that I would just give up. :mad:

If you were some Windows C++ programmers in the 90's, and use the Microsoft Foundation Classes (MFC), Visual C++ would also sprinkle your project with a lot of generated classes and files, which the application programmer is also advised not to edit in the generated comment blocks (or understand what they do anyway). It is a massive bunch of files filled with unknown macros. I avoided the temptation to learn MFC and went to learn Standard Template Library (STL) instead.

Just to add this is the one reason I defected to Java since the mid-1990s. And along the way learnt Perl, Python and PHP. At least all these perform consistently across platforms (Windows and Unix/Linux).
 
Last edited:

ykgoh

Master Member
Joined
Jan 1, 2000
Messages
2,782
Reaction score
0
Now I know that C can be used for do web programming.

With regards to #26,If I am using notepad++,good thing is there is color coding and (new tab)->can open up another space.It also run faster.Cons is it doesn't tell me what error I made,I need to go to Console->Right Click and copy down the error message and search how to resolve.

For IDE I can use F5(Build Project) , F7(Run Project) and save the solution,
it also tell me what mistake I made in advance.

TS, I can see that you're reliant on the Intellisense (auto-completion) feature and Auto-Correct feature in Visual Studio. Nothing wrong with it. Since modern IDEs are all providing this feature like it's a basic thing.

Just to share why davidktw may sound harsh at time. davidktw and I are trained from the old-school era (maybe 80's, 90's), when an IDE was just a plain text editor like Windows Notepad with fixed width font (perhaps DOS white text on blue background with no syntax coloring even). They had no Intellisense auto-completion or auto-correction feature -- considered advanced and alien technologies for our time -- and we probably started programming, compiling and building from the command line manually from scratch. No F5 to Run or Ctrl-Shift-B to Build. We also had to read and interpret the error and warning messages line-by-line from the compiler to understand the problems and fix any problems manually by hand. There was no smart IDE from Microsoft, Borland or Watcom that suggests remedies or solutions for auto-correction. Through this process, we had to learn (and do) things the hard way and to learn how the preprocessor, compiler and linker behaves out of necessity.

There was also no Internet, WWW or Google in the 80's or 90's. We had to consult hardcopy printed documents for programming API. They were like the "Bible" (authoritative reference) of sort for programmers. When I was learning C/C++ programming, the API was printed as an Appendix in my Pearson's textbook. After consulting it far too many times, we became familiar with an API and committed those functions and classes to human memory.

I can perfectly understand if you're trying to rush out a working program for an assignment or work, or just want something that works. You may not be interested or too rushed to understand why a compilation or build fails or how a compiler behaves. But it's up to you how far and how deep you want to learn. Not everyone is motivated in programming, as much as everyone has their own personality, inclinations and hobbies.

I consider myself a senior citizen in the IT industry already since it moves so much faster than all other industries combined. Knowledge of an IT product or platform is easily superseded within 5 to 10 years max.

I notice newer generations of IT students in the last decade have no problem banging out programs in high level PHP, Ruby, Java, .NET, JavaScript and Python. But they are quite adverse or unused to lower level old school stuffs like C/C++/Perl. Maybe can leave them to old folks like me to maintain. But I've not reached x86 assembly language yet. Coding in assembly and raw machine code is epic to the max. :D
 

davidktw

Arch-Supremacy Member
Joined
Apr 15, 2010
Messages
13,550
Reaction score
1,302
TS, I can see that you're reliant on the Intellisense (auto-completion) feature and Auto-Correct feature in Visual Studio. Nothing wrong with it. Since modern IDEs are all providing this feature like it's a basic thing.

...(more text)

I notice newer generations of IT students in the last decade have no problem banging out programs in high level PHP, Ruby, Java, .NET, JavaScript and Python. But they are quite adverse or unused to lower level old school stuffs like C/C++/Perl. Maybe can leave them to old folks like me to maintain. But I've not reached x86 assembly language yet. Coding in assembly and raw machine code is epic to the max. :D

Lolx... Mr Goh, you make me seems older than what I'm suppose to be. I still feels pretty young in my heart ok ? While I'm born before the 80s, I didn't officially(school trained) pick up programming until in late 1990s in the JC. You probably started earlier than I do :) I only played with it back in my secondary times, nothing serious at all.

But I can't help to feel disappointed with programmers that "rely" on IDE to the extend where they can't kickstart programming without all those bells and whistles that comes with it. There is a very big difference between having these extras to help in productivity and efficiency, versus reliant on them like fish needing water to survive.

My days started with notepad and coloured text-based editors like the MS-DOS edit. Then came the IDE which totally didn't attract me though I use them from time to time. But I made the choice to go VIM because I know the importance to be proficient in using a powerful text based tool as oppose to the graphical UI.

I must think this is not old school or not, it is a deliberate decision which all programmers should seriously think about. Will they be able to survive if I will to throw them right in front of the server screen standing in the data centre working. What makes them think they will even get a graphical interface ?

If a programmer comes to the state of not able to proceed with programming without an IDE and all those auto-completion of which library to import before using a method or function from the API, it is a pretty sad thing.

I guess I'm not as lenient as you when it comes to expectation from these younger generations. It doesn't matter if you are a senior or junior in this industry, you get prune out just the same not knowing how well you can survive in harsh conditions. It works in all industries just about the same, except in the IT industry it is so much more apparent because things are moving really very quickly and any sign of you not able to catch up with the pace means you get left out very easily.

So to twinbaby and whomever you are out there. My words are very simple to you, if you have what it takes and you are in for a challenge, then be ready for a really fast pace knowledge building process and on-going turmoils to keep yourself above the water. Otherwise be ready to be prune out of the system so fast that you don't even feel it. The trouble is not with the water current above, the one that get you killed is the undercurrent that you don't see.

(^.^)
 

twinbaby

Supremacy Member
Joined
Jul 8, 2014
Messages
5,470
Reaction score
1,534
So your fix is to use VS2012 instead of VS2010? And the Intellisense works?

See: What's the use for "stdafx.h" in Visual Studio? - Stack Overflow

--snip--
If you were some Windows C++ programmers in the 90's, and use the Microsoft Foundation Classes (MFC), Visual C++ would also sprinkle your project with a lot of generated classes and files, which the application programmer is also advised not to edit in the generated comment blocks (or understand what they do anyway). It is a massive bunch of files filled with unknown macros. I avoided the temptation to learn MFC and went to learn Standard Template Library (STL) instead.
--snip--

I have tried your method,but it ask me to port over my code;

ftk8yr.png


you mean there are so many variants of C++?
C++11,MFC,STL,C,Objective C,that is why when i type in google there are so many solution,but which one could be the right one.
 
Important Forum Advisory Note
This forum is moderated by volunteer moderators who will react only to members' feedback on posts. Moderators are not employees or representatives of HWZ Forums. Forum members and moderators are responsible for their own posts. Please refer to our Community Guidelines and Standards and Terms and Conditions for more information.
Top