:: is scope operator 2 C++ Initialization Lists Initialization lists can be used to pass additional parameters to parent class. public Bar::Bar() : ParentClassName(parentclass_constructor_params) {} In some cases, this can simplify code, of course you can always pass parentclass_constructor_params to Bar and then call super() with param list. Initialization lists can also be used to initialize data fields, for example, [CPR] class Baz { public: Baz() : _foo( "initialize foo first" ), _bar( "then bar" ) { } private: std::string _foo; std::string _bar; }; 3 Pointers to Data Members C++ allows you to declare pointers to data members.[IF] In some cases, this makes it a lot easier to manipulate databases, for example, looping through them, etc. class A { public: int num; int x; }; int A::*pmi = &A::num; 4 Pure Vitural Functions and Virtual Functions Pure Virtual Function is a Virtual function with no body[EX] class classname //This denotes the base class of C++ virtual function { public: virtual void virtualfunctioname() = 0 //This denotes the pure virtual function in C++ }; 5 Pointers and references Pointers and references both hold addresses to another variable. The behave similarly, with some syntactical differences. [A] int x = 1; int *px = &x; // px is a pointer, holding the address of variable x, the & sign before x is the "address of" operator int &rx = x; // rx is a reference to variable x, holding address of variable x In the example above, *px is the same as x. 6 How do I check if a system is little-endian or big-endian? bool BigEndian() { unsigned short s = 0x0001; return ! *(unsigned char*)&s; } 7 Preprocessor Directives In C, preprocessor directives start with a pound sign (#). They are not part of actual C statements, therefore, they don't have to end with a semi-colon[A]. Preprocessor directives can be used to define macros (variables or functions), conditional inclusions at compile time with (#ifdef, #ifndef, #if, #endif, #else and #elif), line control with #line number, Error directive with #error Source file inclusion with #include Pragma directive (#pragma), platform-specific Here's a list of pre-defined preprocessor directives: __LINE__ __FILE__ __DATE__ __TIME__ __cplusplus (standard compliance) 8 What is extern, what's extern "C" extern declares a global variable defined somewhere else, and used in current location. extern "C" is a linkage declaration. It prevents C++ compiler from name mangling. By default, the C++ compiler uses a technique termed name mangling which incorporates the function name with its signature (list of arguments) in order to create a unique name for it, extern "C" disables that behavior. [DEVX] 9 When can I use sizeof to get size of an item? Size of can correctly return size of variables of any atomic data type. If applied to a class, struct, or union, sizeof returns the number of bytes in an object of that type plus any padding added to align members on word boundaries. So the result might not be exactly the sub of member variables. The /Zp compiler option and the pack pragma affect alignment boundaries for members. Sizeof never returns 0. Sizeof operator cannot be used with functions, bit fields, void type, dynamically allocated arrays, external arrays, etc. 10 If I have a method foo(MyClass *arrayPointers[]), how do I initialize arrayPointer as an arg? MyClass *arrayPointers = NULL; foo(&arrayPointers); 11 What is pkg-config? It's a tool for specifying compiler command-line options. [PC] 12 What's the difference between main() and _tmain() generated by VC? In VC, _tmain may be translated to wmain() if you use unicode, otherwise it's translated to main() 13 cout is not a member of std Need #include <iostream> 14 C++ forbids declaration of vector with no type include <vector> 15 undefined reference to "function name" Linker couldn't find your method to link with. This usually means some .o files are missing. Check your make file and make sure that you have all source files inclueded when you compile. 16 expected unqualified-id before xxx in abc.h Could be many reasons, one hard-to-find one could be caused by missing semi-colon after you finish specifying a class 17 invalid conversion from const char* to char* Converting a const char* to char* leads to undefined behavior. You need to convert const char* to char* with strcpy. char *buf = new char[GetUser().size()]; strcpy(buf, GetUser().c_str()); char* userName = buf; [CG] 18 How do I convert a C++ string vector to a const char* array? const char** Utils::StrVector2ConstCharArray(vector<string> v) { int size = v.size(); const char** result = new const char*[size]; for(int i=0; i<size; i++) { result[i] = v.at(i).c_str(); } return result; } 19 debug assertion failed str!=NULL in fprintf.c Check your params to vfprintf and see if any one of them is NULL. For example, file handle has to be initialized. 20 error PRJ0003 : Error spawning 'cl.exe In visualstudio, Tools --> Options -> Projects -> VC++ directories. Add your cl.exe directory in. 21 fatal error LNK1112: module machine type 'x64' conflicts with target machine type 'X86' your cl.exe is of a different version from your target config. Check your C:\Program Files\Microsoft Visual Studio 9.0\VC\bin directory, and make sure you are running the correct cl.exe (32 bit or 64bit). If you are seeing this problem with Visual Studio 2008 on vista, it's not your fault. Somehow VS2008 thinks your system is 64bit and doesn't install the 32 bit cl.exe at all. In those cases, you could just try to fix this by copying Microsoft Visual Studio 9.0\VC\bin from another host.[SM] 22 How do I set command line parameter when debugging my programs in visual studio? Project->Properties->Debugging->Command Arguments [A] 23 How do I set environment variables in visual studio? Project->Properties->Debugging->Environment, add Name=Value lines into the box, for example PATH=C:\aaa;%PATH 24 There are no conversions to array types, although there are conversions to references or pointers to arrays If you do "char *a[] = new char*[10]", you see this error message, don't be fooled by *'s or pointers, this is a plain array issue: you can't assign arrays. For example, you'll get the same error if you do the following int a[] = new int[10] You'll need to use a loop to assign the elements one by one. 25 Why do I need STL? STL is Standard Template Library. It was originally proposed by SGI, and then adopted as part of the standard C++ library, although there are things that are in CGI STL but not c++ standard STL and vice versa. STL library contains a set of containers and algorithm. STL is very generic and therefore heavily parameterized. Almost every class in STL is a template.CGI http://www.sgi.com/tech/stl/stl_introduction.html CGI STL contains containers vector, list, deque, set, multiset, map, multimap, hash_set, hash_multiset, hash_map, and hash_multimap, as well as a bunch of other containers, iterators and algorithms. For a full list of objects in CGI STL, see http://www.sgi.com/tech/stl/table_of_contents.html. C++ standard STL has containers: vector, deque, list, map, set, stack, queue, bitset and algorithm, functional, iterator Aside from being general purpose and having commonly used algorithms wrapped in, STL also takes memory management off your hands. For example, std::vector is smilar to int[], however when using std::vector, you don't have to worry anything about memory management, the STL template handles that. Comments References[A] http://www.geekpedia.com/KB30_How-can-I-pass-command-line-arguments-while-debugging-within-Visual-Studio-.NET.html[CG] http://www.codeguru.com/forum/printthread.php?t=374984[CPR] http://www.cprogramming.com/tutorial/initialization-lists-c++.html[DEVX] http://www.devx.com/tips/Tip/12527[EX] http://www.exforsys.com/tutorials/c-plus-plus/c-pure-virtual-function-and-base-class.html[IF] http://www.informit.com/guides/content.aspx?g=cplusplus&seqNum=142[PC] http://pkg-config.freedesktop.org/wiki/[SM] http://social.msdn.microsoft.com/forums/en-US/vcplus2008prerelease/thread/a6eb88c0-5b17-4811-ba08-c4e753c4d039/
Initialization lists can be used to pass additional parameters to parent class.
public Bar::Bar() : ParentClassName(parentclass_constructor_params) {}
Initialization lists can also be used to initialize data fields, for example, [CPR]
class Baz { public: Baz() : _foo( "initialize foo first" ), _bar( "then bar" ) { } private: std::string _foo; std::string _bar; };
private: std::string _foo; std::string _bar; };
3 Pointers to Data Members C++ allows you to declare pointers to data members.[IF] In some cases, this makes it a lot easier to manipulate databases, for example, looping through them, etc. class A { public: int num; int x; }; int A::*pmi = &A::num; 4 Pure Vitural Functions and Virtual Functions Pure Virtual Function is a Virtual function with no body[EX] class classname //This denotes the base class of C++ virtual function { public: virtual void virtualfunctioname() = 0 //This denotes the pure virtual function in C++ }; 5 Pointers and references Pointers and references both hold addresses to another variable. The behave similarly, with some syntactical differences. [A] int x = 1; int *px = &x; // px is a pointer, holding the address of variable x, the & sign before x is the "address of" operator int &rx = x; // rx is a reference to variable x, holding address of variable x In the example above, *px is the same as x. 6 How do I check if a system is little-endian or big-endian? bool BigEndian() { unsigned short s = 0x0001; return ! *(unsigned char*)&s; } 7 Preprocessor Directives In C, preprocessor directives start with a pound sign (#). They are not part of actual C statements, therefore, they don't have to end with a semi-colon[A]. Preprocessor directives can be used to define macros (variables or functions), conditional inclusions at compile time with (#ifdef, #ifndef, #if, #endif, #else and #elif), line control with #line number, Error directive with #error Source file inclusion with #include Pragma directive (#pragma), platform-specific Here's a list of pre-defined preprocessor directives: __LINE__ __FILE__ __DATE__ __TIME__ __cplusplus (standard compliance) 8 What is extern, what's extern "C" extern declares a global variable defined somewhere else, and used in current location. extern "C" is a linkage declaration. It prevents C++ compiler from name mangling. By default, the C++ compiler uses a technique termed name mangling which incorporates the function name with its signature (list of arguments) in order to create a unique name for it, extern "C" disables that behavior. [DEVX] 9 When can I use sizeof to get size of an item? Size of can correctly return size of variables of any atomic data type. If applied to a class, struct, or union, sizeof returns the number of bytes in an object of that type plus any padding added to align members on word boundaries. So the result might not be exactly the sub of member variables. The /Zp compiler option and the pack pragma affect alignment boundaries for members. Sizeof never returns 0. Sizeof operator cannot be used with functions, bit fields, void type, dynamically allocated arrays, external arrays, etc. 10 If I have a method foo(MyClass *arrayPointers[]), how do I initialize arrayPointer as an arg? MyClass *arrayPointers = NULL; foo(&arrayPointers); 11 What is pkg-config? It's a tool for specifying compiler command-line options. [PC] 12 What's the difference between main() and _tmain() generated by VC? In VC, _tmain may be translated to wmain() if you use unicode, otherwise it's translated to main() 13 cout is not a member of std Need #include <iostream> 14 C++ forbids declaration of vector with no type include <vector> 15 undefined reference to "function name" Linker couldn't find your method to link with. This usually means some .o files are missing. Check your make file and make sure that you have all source files inclueded when you compile. 16 expected unqualified-id before xxx in abc.h Could be many reasons, one hard-to-find one could be caused by missing semi-colon after you finish specifying a class 17 invalid conversion from const char* to char* Converting a const char* to char* leads to undefined behavior. You need to convert const char* to char* with strcpy. char *buf = new char[GetUser().size()]; strcpy(buf, GetUser().c_str()); char* userName = buf; [CG] 18 How do I convert a C++ string vector to a const char* array? const char** Utils::StrVector2ConstCharArray(vector<string> v) { int size = v.size(); const char** result = new const char*[size]; for(int i=0; i<size; i++) { result[i] = v.at(i).c_str(); } return result; } 19 debug assertion failed str!=NULL in fprintf.c Check your params to vfprintf and see if any one of them is NULL. For example, file handle has to be initialized. 20 error PRJ0003 : Error spawning 'cl.exe In visualstudio, Tools --> Options -> Projects -> VC++ directories. Add your cl.exe directory in. 21 fatal error LNK1112: module machine type 'x64' conflicts with target machine type 'X86' your cl.exe is of a different version from your target config. Check your C:\Program Files\Microsoft Visual Studio 9.0\VC\bin directory, and make sure you are running the correct cl.exe (32 bit or 64bit). If you are seeing this problem with Visual Studio 2008 on vista, it's not your fault. Somehow VS2008 thinks your system is 64bit and doesn't install the 32 bit cl.exe at all. In those cases, you could just try to fix this by copying Microsoft Visual Studio 9.0\VC\bin from another host.[SM] 22 How do I set command line parameter when debugging my programs in visual studio? Project->Properties->Debugging->Command Arguments [A] 23 How do I set environment variables in visual studio? Project->Properties->Debugging->Environment, add Name=Value lines into the box, for example PATH=C:\aaa;%PATH 24 There are no conversions to array types, although there are conversions to references or pointers to arrays If you do "char *a[] = new char*[10]", you see this error message, don't be fooled by *'s or pointers, this is a plain array issue: you can't assign arrays. For example, you'll get the same error if you do the following int a[] = new int[10] You'll need to use a loop to assign the elements one by one. 25 Why do I need STL? STL is Standard Template Library. It was originally proposed by SGI, and then adopted as part of the standard C++ library, although there are things that are in CGI STL but not c++ standard STL and vice versa. STL library contains a set of containers and algorithm. STL is very generic and therefore heavily parameterized. Almost every class in STL is a template.CGI http://www.sgi.com/tech/stl/stl_introduction.html CGI STL contains containers vector, list, deque, set, multiset, map, multimap, hash_set, hash_multiset, hash_map, and hash_multimap, as well as a bunch of other containers, iterators and algorithms. For a full list of objects in CGI STL, see http://www.sgi.com/tech/stl/table_of_contents.html. C++ standard STL has containers: vector, deque, list, map, set, stack, queue, bitset and algorithm, functional, iterator Aside from being general purpose and having commonly used algorithms wrapped in, STL also takes memory management off your hands. For example, std::vector is smilar to int[], however when using std::vector, you don't have to worry anything about memory management, the STL template handles that. Comments References[A] http://www.geekpedia.com/KB30_How-can-I-pass-command-line-arguments-while-debugging-within-Visual-Studio-.NET.html[CG] http://www.codeguru.com/forum/printthread.php?t=374984[CPR] http://www.cprogramming.com/tutorial/initialization-lists-c++.html[DEVX] http://www.devx.com/tips/Tip/12527[EX] http://www.exforsys.com/tutorials/c-plus-plus/c-pure-virtual-function-and-base-class.html[IF] http://www.informit.com/guides/content.aspx?g=cplusplus&seqNum=142[PC] http://pkg-config.freedesktop.org/wiki/[SM] http://social.msdn.microsoft.com/forums/en-US/vcplus2008prerelease/thread/a6eb88c0-5b17-4811-ba08-c4e753c4d039/
C++ allows you to declare pointers to data members.[IF]
In some cases, this makes it a lot easier to manipulate databases, for example, looping through them, etc.
class A { public: int num; int x; }; int A::*pmi = &A::num;
4 Pure Vitural Functions and Virtual Functions Pure Virtual Function is a Virtual function with no body[EX] class classname //This denotes the base class of C++ virtual function { public: virtual void virtualfunctioname() = 0 //This denotes the pure virtual function in C++ }; 5 Pointers and references Pointers and references both hold addresses to another variable. The behave similarly, with some syntactical differences. [A] int x = 1; int *px = &x; // px is a pointer, holding the address of variable x, the & sign before x is the "address of" operator int &rx = x; // rx is a reference to variable x, holding address of variable x In the example above, *px is the same as x. 6 How do I check if a system is little-endian or big-endian? bool BigEndian() { unsigned short s = 0x0001; return ! *(unsigned char*)&s; } 7 Preprocessor Directives In C, preprocessor directives start with a pound sign (#). They are not part of actual C statements, therefore, they don't have to end with a semi-colon[A]. Preprocessor directives can be used to define macros (variables or functions), conditional inclusions at compile time with (#ifdef, #ifndef, #if, #endif, #else and #elif), line control with #line number, Error directive with #error Source file inclusion with #include Pragma directive (#pragma), platform-specific Here's a list of pre-defined preprocessor directives: __LINE__ __FILE__ __DATE__ __TIME__ __cplusplus (standard compliance) 8 What is extern, what's extern "C" extern declares a global variable defined somewhere else, and used in current location. extern "C" is a linkage declaration. It prevents C++ compiler from name mangling. By default, the C++ compiler uses a technique termed name mangling which incorporates the function name with its signature (list of arguments) in order to create a unique name for it, extern "C" disables that behavior. [DEVX] 9 When can I use sizeof to get size of an item? Size of can correctly return size of variables of any atomic data type. If applied to a class, struct, or union, sizeof returns the number of bytes in an object of that type plus any padding added to align members on word boundaries. So the result might not be exactly the sub of member variables. The /Zp compiler option and the pack pragma affect alignment boundaries for members. Sizeof never returns 0. Sizeof operator cannot be used with functions, bit fields, void type, dynamically allocated arrays, external arrays, etc. 10 If I have a method foo(MyClass *arrayPointers[]), how do I initialize arrayPointer as an arg? MyClass *arrayPointers = NULL; foo(&arrayPointers); 11 What is pkg-config? It's a tool for specifying compiler command-line options. [PC] 12 What's the difference between main() and _tmain() generated by VC? In VC, _tmain may be translated to wmain() if you use unicode, otherwise it's translated to main() 13 cout is not a member of std Need #include <iostream> 14 C++ forbids declaration of vector with no type include <vector> 15 undefined reference to "function name" Linker couldn't find your method to link with. This usually means some .o files are missing. Check your make file and make sure that you have all source files inclueded when you compile. 16 expected unqualified-id before xxx in abc.h Could be many reasons, one hard-to-find one could be caused by missing semi-colon after you finish specifying a class 17 invalid conversion from const char* to char* Converting a const char* to char* leads to undefined behavior. You need to convert const char* to char* with strcpy. char *buf = new char[GetUser().size()]; strcpy(buf, GetUser().c_str()); char* userName = buf; [CG] 18 How do I convert a C++ string vector to a const char* array? const char** Utils::StrVector2ConstCharArray(vector<string> v) { int size = v.size(); const char** result = new const char*[size]; for(int i=0; i<size; i++) { result[i] = v.at(i).c_str(); } return result; } 19 debug assertion failed str!=NULL in fprintf.c Check your params to vfprintf and see if any one of them is NULL. For example, file handle has to be initialized. 20 error PRJ0003 : Error spawning 'cl.exe In visualstudio, Tools --> Options -> Projects -> VC++ directories. Add your cl.exe directory in. 21 fatal error LNK1112: module machine type 'x64' conflicts with target machine type 'X86' your cl.exe is of a different version from your target config. Check your C:\Program Files\Microsoft Visual Studio 9.0\VC\bin directory, and make sure you are running the correct cl.exe (32 bit or 64bit). If you are seeing this problem with Visual Studio 2008 on vista, it's not your fault. Somehow VS2008 thinks your system is 64bit and doesn't install the 32 bit cl.exe at all. In those cases, you could just try to fix this by copying Microsoft Visual Studio 9.0\VC\bin from another host.[SM] 22 How do I set command line parameter when debugging my programs in visual studio? Project->Properties->Debugging->Command Arguments [A] 23 How do I set environment variables in visual studio? Project->Properties->Debugging->Environment, add Name=Value lines into the box, for example PATH=C:\aaa;%PATH 24 There are no conversions to array types, although there are conversions to references or pointers to arrays If you do "char *a[] = new char*[10]", you see this error message, don't be fooled by *'s or pointers, this is a plain array issue: you can't assign arrays. For example, you'll get the same error if you do the following int a[] = new int[10] You'll need to use a loop to assign the elements one by one. 25 Why do I need STL? STL is Standard Template Library. It was originally proposed by SGI, and then adopted as part of the standard C++ library, although there are things that are in CGI STL but not c++ standard STL and vice versa. STL library contains a set of containers and algorithm. STL is very generic and therefore heavily parameterized. Almost every class in STL is a template.CGI http://www.sgi.com/tech/stl/stl_introduction.html CGI STL contains containers vector, list, deque, set, multiset, map, multimap, hash_set, hash_multiset, hash_map, and hash_multimap, as well as a bunch of other containers, iterators and algorithms. For a full list of objects in CGI STL, see http://www.sgi.com/tech/stl/table_of_contents.html. C++ standard STL has containers: vector, deque, list, map, set, stack, queue, bitset and algorithm, functional, iterator Aside from being general purpose and having commonly used algorithms wrapped in, STL also takes memory management off your hands. For example, std::vector is smilar to int[], however when using std::vector, you don't have to worry anything about memory management, the STL template handles that. Comments References[A] http://www.geekpedia.com/KB30_How-can-I-pass-command-line-arguments-while-debugging-within-Visual-Studio-.NET.html[CG] http://www.codeguru.com/forum/printthread.php?t=374984[CPR] http://www.cprogramming.com/tutorial/initialization-lists-c++.html[DEVX] http://www.devx.com/tips/Tip/12527[EX] http://www.exforsys.com/tutorials/c-plus-plus/c-pure-virtual-function-and-base-class.html[IF] http://www.informit.com/guides/content.aspx?g=cplusplus&seqNum=142[PC] http://pkg-config.freedesktop.org/wiki/[SM] http://social.msdn.microsoft.com/forums/en-US/vcplus2008prerelease/thread/a6eb88c0-5b17-4811-ba08-c4e753c4d039/
Pure Virtual Function is a Virtual function with no body[EX]
class classname //This denotes the base class of C++ virtual function { public: virtual void virtualfunctioname() = 0 //This denotes the pure virtual function in C++ };
5 Pointers and references Pointers and references both hold addresses to another variable. The behave similarly, with some syntactical differences. [A] int x = 1; int *px = &x; // px is a pointer, holding the address of variable x, the & sign before x is the "address of" operator int &rx = x; // rx is a reference to variable x, holding address of variable x In the example above, *px is the same as x. 6 How do I check if a system is little-endian or big-endian? bool BigEndian() { unsigned short s = 0x0001; return ! *(unsigned char*)&s; } 7 Preprocessor Directives In C, preprocessor directives start with a pound sign (#). They are not part of actual C statements, therefore, they don't have to end with a semi-colon[A]. Preprocessor directives can be used to define macros (variables or functions), conditional inclusions at compile time with (#ifdef, #ifndef, #if, #endif, #else and #elif), line control with #line number, Error directive with #error Source file inclusion with #include Pragma directive (#pragma), platform-specific Here's a list of pre-defined preprocessor directives: __LINE__ __FILE__ __DATE__ __TIME__ __cplusplus (standard compliance) 8 What is extern, what's extern "C" extern declares a global variable defined somewhere else, and used in current location. extern "C" is a linkage declaration. It prevents C++ compiler from name mangling. By default, the C++ compiler uses a technique termed name mangling which incorporates the function name with its signature (list of arguments) in order to create a unique name for it, extern "C" disables that behavior. [DEVX] 9 When can I use sizeof to get size of an item? Size of can correctly return size of variables of any atomic data type. If applied to a class, struct, or union, sizeof returns the number of bytes in an object of that type plus any padding added to align members on word boundaries. So the result might not be exactly the sub of member variables. The /Zp compiler option and the pack pragma affect alignment boundaries for members. Sizeof never returns 0. Sizeof operator cannot be used with functions, bit fields, void type, dynamically allocated arrays, external arrays, etc. 10 If I have a method foo(MyClass *arrayPointers[]), how do I initialize arrayPointer as an arg? MyClass *arrayPointers = NULL; foo(&arrayPointers); 11 What is pkg-config? It's a tool for specifying compiler command-line options. [PC] 12 What's the difference between main() and _tmain() generated by VC? In VC, _tmain may be translated to wmain() if you use unicode, otherwise it's translated to main() 13 cout is not a member of std Need #include <iostream> 14 C++ forbids declaration of vector with no type include <vector> 15 undefined reference to "function name" Linker couldn't find your method to link with. This usually means some .o files are missing. Check your make file and make sure that you have all source files inclueded when you compile. 16 expected unqualified-id before xxx in abc.h Could be many reasons, one hard-to-find one could be caused by missing semi-colon after you finish specifying a class 17 invalid conversion from const char* to char* Converting a const char* to char* leads to undefined behavior. You need to convert const char* to char* with strcpy. char *buf = new char[GetUser().size()]; strcpy(buf, GetUser().c_str()); char* userName = buf; [CG] 18 How do I convert a C++ string vector to a const char* array? const char** Utils::StrVector2ConstCharArray(vector<string> v) { int size = v.size(); const char** result = new const char*[size]; for(int i=0; i<size; i++) { result[i] = v.at(i).c_str(); } return result; } 19 debug assertion failed str!=NULL in fprintf.c Check your params to vfprintf and see if any one of them is NULL. For example, file handle has to be initialized. 20 error PRJ0003 : Error spawning 'cl.exe In visualstudio, Tools --> Options -> Projects -> VC++ directories. Add your cl.exe directory in. 21 fatal error LNK1112: module machine type 'x64' conflicts with target machine type 'X86' your cl.exe is of a different version from your target config. Check your C:\Program Files\Microsoft Visual Studio 9.0\VC\bin directory, and make sure you are running the correct cl.exe (32 bit or 64bit). If you are seeing this problem with Visual Studio 2008 on vista, it's not your fault. Somehow VS2008 thinks your system is 64bit and doesn't install the 32 bit cl.exe at all. In those cases, you could just try to fix this by copying Microsoft Visual Studio 9.0\VC\bin from another host.[SM] 22 How do I set command line parameter when debugging my programs in visual studio? Project->Properties->Debugging->Command Arguments [A] 23 How do I set environment variables in visual studio? Project->Properties->Debugging->Environment, add Name=Value lines into the box, for example PATH=C:\aaa;%PATH 24 There are no conversions to array types, although there are conversions to references or pointers to arrays If you do "char *a[] = new char*[10]", you see this error message, don't be fooled by *'s or pointers, this is a plain array issue: you can't assign arrays. For example, you'll get the same error if you do the following int a[] = new int[10] You'll need to use a loop to assign the elements one by one. 25 Why do I need STL? STL is Standard Template Library. It was originally proposed by SGI, and then adopted as part of the standard C++ library, although there are things that are in CGI STL but not c++ standard STL and vice versa. STL library contains a set of containers and algorithm. STL is very generic and therefore heavily parameterized. Almost every class in STL is a template.CGI http://www.sgi.com/tech/stl/stl_introduction.html CGI STL contains containers vector, list, deque, set, multiset, map, multimap, hash_set, hash_multiset, hash_map, and hash_multimap, as well as a bunch of other containers, iterators and algorithms. For a full list of objects in CGI STL, see http://www.sgi.com/tech/stl/table_of_contents.html. C++ standard STL has containers: vector, deque, list, map, set, stack, queue, bitset and algorithm, functional, iterator Aside from being general purpose and having commonly used algorithms wrapped in, STL also takes memory management off your hands. For example, std::vector is smilar to int[], however when using std::vector, you don't have to worry anything about memory management, the STL template handles that. Comments References[A] http://www.geekpedia.com/KB30_How-can-I-pass-command-line-arguments-while-debugging-within-Visual-Studio-.NET.html[CG] http://www.codeguru.com/forum/printthread.php?t=374984[CPR] http://www.cprogramming.com/tutorial/initialization-lists-c++.html[DEVX] http://www.devx.com/tips/Tip/12527[EX] http://www.exforsys.com/tutorials/c-plus-plus/c-pure-virtual-function-and-base-class.html[IF] http://www.informit.com/guides/content.aspx?g=cplusplus&seqNum=142[PC] http://pkg-config.freedesktop.org/wiki/[SM] http://social.msdn.microsoft.com/forums/en-US/vcplus2008prerelease/thread/a6eb88c0-5b17-4811-ba08-c4e753c4d039/
Pointers and references both hold addresses to another variable. The behave similarly, with some syntactical differences. [A]
int x = 1; int *px = &x; // px is a pointer, holding the address of variable x, the & sign before x is the "address of" operator int &rx = x; // rx is a reference to variable x, holding address of variable x
In the example above, *px is the same as x. 6 How do I check if a system is little-endian or big-endian? bool BigEndian() { unsigned short s = 0x0001; return ! *(unsigned char*)&s; } 7 Preprocessor Directives In C, preprocessor directives start with a pound sign (#). They are not part of actual C statements, therefore, they don't have to end with a semi-colon[A]. Preprocessor directives can be used to define macros (variables or functions), conditional inclusions at compile time with (#ifdef, #ifndef, #if, #endif, #else and #elif), line control with #line number, Error directive with #error Source file inclusion with #include Pragma directive (#pragma), platform-specific Here's a list of pre-defined preprocessor directives: __LINE__ __FILE__ __DATE__ __TIME__ __cplusplus (standard compliance) 8 What is extern, what's extern "C" extern declares a global variable defined somewhere else, and used in current location. extern "C" is a linkage declaration. It prevents C++ compiler from name mangling. By default, the C++ compiler uses a technique termed name mangling which incorporates the function name with its signature (list of arguments) in order to create a unique name for it, extern "C" disables that behavior. [DEVX] 9 When can I use sizeof to get size of an item? Size of can correctly return size of variables of any atomic data type. If applied to a class, struct, or union, sizeof returns the number of bytes in an object of that type plus any padding added to align members on word boundaries. So the result might not be exactly the sub of member variables. The /Zp compiler option and the pack pragma affect alignment boundaries for members. Sizeof never returns 0. Sizeof operator cannot be used with functions, bit fields, void type, dynamically allocated arrays, external arrays, etc. 10 If I have a method foo(MyClass *arrayPointers[]), how do I initialize arrayPointer as an arg? MyClass *arrayPointers = NULL; foo(&arrayPointers); 11 What is pkg-config? It's a tool for specifying compiler command-line options. [PC] 12 What's the difference between main() and _tmain() generated by VC? In VC, _tmain may be translated to wmain() if you use unicode, otherwise it's translated to main() 13 cout is not a member of std Need #include <iostream> 14 C++ forbids declaration of vector with no type include <vector> 15 undefined reference to "function name" Linker couldn't find your method to link with. This usually means some .o files are missing. Check your make file and make sure that you have all source files inclueded when you compile. 16 expected unqualified-id before xxx in abc.h Could be many reasons, one hard-to-find one could be caused by missing semi-colon after you finish specifying a class 17 invalid conversion from const char* to char* Converting a const char* to char* leads to undefined behavior. You need to convert const char* to char* with strcpy. char *buf = new char[GetUser().size()]; strcpy(buf, GetUser().c_str()); char* userName = buf; [CG] 18 How do I convert a C++ string vector to a const char* array? const char** Utils::StrVector2ConstCharArray(vector<string> v) { int size = v.size(); const char** result = new const char*[size]; for(int i=0; i<size; i++) { result[i] = v.at(i).c_str(); } return result; } 19 debug assertion failed str!=NULL in fprintf.c Check your params to vfprintf and see if any one of them is NULL. For example, file handle has to be initialized. 20 error PRJ0003 : Error spawning 'cl.exe In visualstudio, Tools --> Options -> Projects -> VC++ directories. Add your cl.exe directory in. 21 fatal error LNK1112: module machine type 'x64' conflicts with target machine type 'X86' your cl.exe is of a different version from your target config. Check your C:\Program Files\Microsoft Visual Studio 9.0\VC\bin directory, and make sure you are running the correct cl.exe (32 bit or 64bit). If you are seeing this problem with Visual Studio 2008 on vista, it's not your fault. Somehow VS2008 thinks your system is 64bit and doesn't install the 32 bit cl.exe at all. In those cases, you could just try to fix this by copying Microsoft Visual Studio 9.0\VC\bin from another host.[SM] 22 How do I set command line parameter when debugging my programs in visual studio? Project->Properties->Debugging->Command Arguments [A] 23 How do I set environment variables in visual studio? Project->Properties->Debugging->Environment, add Name=Value lines into the box, for example PATH=C:\aaa;%PATH 24 There are no conversions to array types, although there are conversions to references or pointers to arrays If you do "char *a[] = new char*[10]", you see this error message, don't be fooled by *'s or pointers, this is a plain array issue: you can't assign arrays. For example, you'll get the same error if you do the following int a[] = new int[10] You'll need to use a loop to assign the elements one by one. 25 Why do I need STL? STL is Standard Template Library. It was originally proposed by SGI, and then adopted as part of the standard C++ library, although there are things that are in CGI STL but not c++ standard STL and vice versa. STL library contains a set of containers and algorithm. STL is very generic and therefore heavily parameterized. Almost every class in STL is a template.CGI http://www.sgi.com/tech/stl/stl_introduction.html CGI STL contains containers vector, list, deque, set, multiset, map, multimap, hash_set, hash_multiset, hash_map, and hash_multimap, as well as a bunch of other containers, iterators and algorithms. For a full list of objects in CGI STL, see http://www.sgi.com/tech/stl/table_of_contents.html. C++ standard STL has containers: vector, deque, list, map, set, stack, queue, bitset and algorithm, functional, iterator Aside from being general purpose and having commonly used algorithms wrapped in, STL also takes memory management off your hands. For example, std::vector is smilar to int[], however when using std::vector, you don't have to worry anything about memory management, the STL template handles that. Comments References[A] http://www.geekpedia.com/KB30_How-can-I-pass-command-line-arguments-while-debugging-within-Visual-Studio-.NET.html[CG] http://www.codeguru.com/forum/printthread.php?t=374984[CPR] http://www.cprogramming.com/tutorial/initialization-lists-c++.html[DEVX] http://www.devx.com/tips/Tip/12527[EX] http://www.exforsys.com/tutorials/c-plus-plus/c-pure-virtual-function-and-base-class.html[IF] http://www.informit.com/guides/content.aspx?g=cplusplus&seqNum=142[PC] http://pkg-config.freedesktop.org/wiki/[SM] http://social.msdn.microsoft.com/forums/en-US/vcplus2008prerelease/thread/a6eb88c0-5b17-4811-ba08-c4e753c4d039/
bool BigEndian() { unsigned short s = 0x0001; return ! *(unsigned char*)&s; }
7 Preprocessor Directives In C, preprocessor directives start with a pound sign (#). They are not part of actual C statements, therefore, they don't have to end with a semi-colon[A]. Preprocessor directives can be used to define macros (variables or functions), conditional inclusions at compile time with (#ifdef, #ifndef, #if, #endif, #else and #elif), line control with #line number, Error directive with #error Source file inclusion with #include Pragma directive (#pragma), platform-specific Here's a list of pre-defined preprocessor directives: __LINE__ __FILE__ __DATE__ __TIME__ __cplusplus (standard compliance) 8 What is extern, what's extern "C" extern declares a global variable defined somewhere else, and used in current location. extern "C" is a linkage declaration. It prevents C++ compiler from name mangling. By default, the C++ compiler uses a technique termed name mangling which incorporates the function name with its signature (list of arguments) in order to create a unique name for it, extern "C" disables that behavior. [DEVX] 9 When can I use sizeof to get size of an item? Size of can correctly return size of variables of any atomic data type. If applied to a class, struct, or union, sizeof returns the number of bytes in an object of that type plus any padding added to align members on word boundaries. So the result might not be exactly the sub of member variables. The /Zp compiler option and the pack pragma affect alignment boundaries for members. Sizeof never returns 0. Sizeof operator cannot be used with functions, bit fields, void type, dynamically allocated arrays, external arrays, etc. 10 If I have a method foo(MyClass *arrayPointers[]), how do I initialize arrayPointer as an arg? MyClass *arrayPointers = NULL; foo(&arrayPointers); 11 What is pkg-config? It's a tool for specifying compiler command-line options. [PC] 12 What's the difference between main() and _tmain() generated by VC? In VC, _tmain may be translated to wmain() if you use unicode, otherwise it's translated to main() 13 cout is not a member of std Need #include <iostream> 14 C++ forbids declaration of vector with no type include <vector> 15 undefined reference to "function name" Linker couldn't find your method to link with. This usually means some .o files are missing. Check your make file and make sure that you have all source files inclueded when you compile. 16 expected unqualified-id before xxx in abc.h Could be many reasons, one hard-to-find one could be caused by missing semi-colon after you finish specifying a class 17 invalid conversion from const char* to char* Converting a const char* to char* leads to undefined behavior. You need to convert const char* to char* with strcpy. char *buf = new char[GetUser().size()]; strcpy(buf, GetUser().c_str()); char* userName = buf; [CG] 18 How do I convert a C++ string vector to a const char* array? const char** Utils::StrVector2ConstCharArray(vector<string> v) { int size = v.size(); const char** result = new const char*[size]; for(int i=0; i<size; i++) { result[i] = v.at(i).c_str(); } return result; } 19 debug assertion failed str!=NULL in fprintf.c Check your params to vfprintf and see if any one of them is NULL. For example, file handle has to be initialized. 20 error PRJ0003 : Error spawning 'cl.exe In visualstudio, Tools --> Options -> Projects -> VC++ directories. Add your cl.exe directory in. 21 fatal error LNK1112: module machine type 'x64' conflicts with target machine type 'X86' your cl.exe is of a different version from your target config. Check your C:\Program Files\Microsoft Visual Studio 9.0\VC\bin directory, and make sure you are running the correct cl.exe (32 bit or 64bit). If you are seeing this problem with Visual Studio 2008 on vista, it's not your fault. Somehow VS2008 thinks your system is 64bit and doesn't install the 32 bit cl.exe at all. In those cases, you could just try to fix this by copying Microsoft Visual Studio 9.0\VC\bin from another host.[SM] 22 How do I set command line parameter when debugging my programs in visual studio? Project->Properties->Debugging->Command Arguments [A] 23 How do I set environment variables in visual studio? Project->Properties->Debugging->Environment, add Name=Value lines into the box, for example PATH=C:\aaa;%PATH 24 There are no conversions to array types, although there are conversions to references or pointers to arrays If you do "char *a[] = new char*[10]", you see this error message, don't be fooled by *'s or pointers, this is a plain array issue: you can't assign arrays. For example, you'll get the same error if you do the following int a[] = new int[10] You'll need to use a loop to assign the elements one by one. 25 Why do I need STL? STL is Standard Template Library. It was originally proposed by SGI, and then adopted as part of the standard C++ library, although there are things that are in CGI STL but not c++ standard STL and vice versa. STL library contains a set of containers and algorithm. STL is very generic and therefore heavily parameterized. Almost every class in STL is a template.CGI http://www.sgi.com/tech/stl/stl_introduction.html CGI STL contains containers vector, list, deque, set, multiset, map, multimap, hash_set, hash_multiset, hash_map, and hash_multimap, as well as a bunch of other containers, iterators and algorithms. For a full list of objects in CGI STL, see http://www.sgi.com/tech/stl/table_of_contents.html. C++ standard STL has containers: vector, deque, list, map, set, stack, queue, bitset and algorithm, functional, iterator Aside from being general purpose and having commonly used algorithms wrapped in, STL also takes memory management off your hands. For example, std::vector is smilar to int[], however when using std::vector, you don't have to worry anything about memory management, the STL template handles that. Comments References[A] http://www.geekpedia.com/KB30_How-can-I-pass-command-line-arguments-while-debugging-within-Visual-Studio-.NET.html[CG] http://www.codeguru.com/forum/printthread.php?t=374984[CPR] http://www.cprogramming.com/tutorial/initialization-lists-c++.html[DEVX] http://www.devx.com/tips/Tip/12527[EX] http://www.exforsys.com/tutorials/c-plus-plus/c-pure-virtual-function-and-base-class.html[IF] http://www.informit.com/guides/content.aspx?g=cplusplus&seqNum=142[PC] http://pkg-config.freedesktop.org/wiki/[SM] http://social.msdn.microsoft.com/forums/en-US/vcplus2008prerelease/thread/a6eb88c0-5b17-4811-ba08-c4e753c4d039/
In C, preprocessor directives start with a pound sign (#). They are not part of actual C statements, therefore, they don't have to end with a semi-colon[A]. Preprocessor directives can be used to
8 What is extern, what's extern "C" extern declares a global variable defined somewhere else, and used in current location. extern "C" is a linkage declaration. It prevents C++ compiler from name mangling. By default, the C++ compiler uses a technique termed name mangling which incorporates the function name with its signature (list of arguments) in order to create a unique name for it, extern "C" disables that behavior. [DEVX] 9 When can I use sizeof to get size of an item? Size of can correctly return size of variables of any atomic data type. If applied to a class, struct, or union, sizeof returns the number of bytes in an object of that type plus any padding added to align members on word boundaries. So the result might not be exactly the sub of member variables. The /Zp compiler option and the pack pragma affect alignment boundaries for members. Sizeof never returns 0. Sizeof operator cannot be used with functions, bit fields, void type, dynamically allocated arrays, external arrays, etc. 10 If I have a method foo(MyClass *arrayPointers[]), how do I initialize arrayPointer as an arg? MyClass *arrayPointers = NULL; foo(&arrayPointers); 11 What is pkg-config? It's a tool for specifying compiler command-line options. [PC] 12 What's the difference between main() and _tmain() generated by VC? In VC, _tmain may be translated to wmain() if you use unicode, otherwise it's translated to main() 13 cout is not a member of std Need #include <iostream> 14 C++ forbids declaration of vector with no type include <vector> 15 undefined reference to "function name" Linker couldn't find your method to link with. This usually means some .o files are missing. Check your make file and make sure that you have all source files inclueded when you compile. 16 expected unqualified-id before xxx in abc.h Could be many reasons, one hard-to-find one could be caused by missing semi-colon after you finish specifying a class 17 invalid conversion from const char* to char* Converting a const char* to char* leads to undefined behavior. You need to convert const char* to char* with strcpy. char *buf = new char[GetUser().size()]; strcpy(buf, GetUser().c_str()); char* userName = buf; [CG] 18 How do I convert a C++ string vector to a const char* array? const char** Utils::StrVector2ConstCharArray(vector<string> v) { int size = v.size(); const char** result = new const char*[size]; for(int i=0; i<size; i++) { result[i] = v.at(i).c_str(); } return result; } 19 debug assertion failed str!=NULL in fprintf.c Check your params to vfprintf and see if any one of them is NULL. For example, file handle has to be initialized. 20 error PRJ0003 : Error spawning 'cl.exe In visualstudio, Tools --> Options -> Projects -> VC++ directories. Add your cl.exe directory in. 21 fatal error LNK1112: module machine type 'x64' conflicts with target machine type 'X86' your cl.exe is of a different version from your target config. Check your C:\Program Files\Microsoft Visual Studio 9.0\VC\bin directory, and make sure you are running the correct cl.exe (32 bit or 64bit). If you are seeing this problem with Visual Studio 2008 on vista, it's not your fault. Somehow VS2008 thinks your system is 64bit and doesn't install the 32 bit cl.exe at all. In those cases, you could just try to fix this by copying Microsoft Visual Studio 9.0\VC\bin from another host.[SM] 22 How do I set command line parameter when debugging my programs in visual studio? Project->Properties->Debugging->Command Arguments [A] 23 How do I set environment variables in visual studio? Project->Properties->Debugging->Environment, add Name=Value lines into the box, for example PATH=C:\aaa;%PATH 24 There are no conversions to array types, although there are conversions to references or pointers to arrays If you do "char *a[] = new char*[10]", you see this error message, don't be fooled by *'s or pointers, this is a plain array issue: you can't assign arrays. For example, you'll get the same error if you do the following int a[] = new int[10] You'll need to use a loop to assign the elements one by one. 25 Why do I need STL? STL is Standard Template Library. It was originally proposed by SGI, and then adopted as part of the standard C++ library, although there are things that are in CGI STL but not c++ standard STL and vice versa. STL library contains a set of containers and algorithm. STL is very generic and therefore heavily parameterized. Almost every class in STL is a template.CGI http://www.sgi.com/tech/stl/stl_introduction.html CGI STL contains containers vector, list, deque, set, multiset, map, multimap, hash_set, hash_multiset, hash_map, and hash_multimap, as well as a bunch of other containers, iterators and algorithms. For a full list of objects in CGI STL, see http://www.sgi.com/tech/stl/table_of_contents.html. C++ standard STL has containers: vector, deque, list, map, set, stack, queue, bitset and algorithm, functional, iterator Aside from being general purpose and having commonly used algorithms wrapped in, STL also takes memory management off your hands. For example, std::vector is smilar to int[], however when using std::vector, you don't have to worry anything about memory management, the STL template handles that. Comments References[A] http://www.geekpedia.com/KB30_How-can-I-pass-command-line-arguments-while-debugging-within-Visual-Studio-.NET.html[CG] http://www.codeguru.com/forum/printthread.php?t=374984[CPR] http://www.cprogramming.com/tutorial/initialization-lists-c++.html[DEVX] http://www.devx.com/tips/Tip/12527[EX] http://www.exforsys.com/tutorials/c-plus-plus/c-pure-virtual-function-and-base-class.html[IF] http://www.informit.com/guides/content.aspx?g=cplusplus&seqNum=142[PC] http://pkg-config.freedesktop.org/wiki/[SM] http://social.msdn.microsoft.com/forums/en-US/vcplus2008prerelease/thread/a6eb88c0-5b17-4811-ba08-c4e753c4d039/
extern declares a global variable defined somewhere else, and used in current location.
extern "C" is a linkage declaration. It prevents C++ compiler from name mangling. By default, the C++ compiler uses a technique termed name mangling which incorporates the function name with its signature (list of arguments) in order to create a unique name for it, extern "C" disables that behavior. [DEVX]
9 When can I use sizeof to get size of an item? Size of can correctly return size of variables of any atomic data type. If applied to a class, struct, or union, sizeof returns the number of bytes in an object of that type plus any padding added to align members on word boundaries. So the result might not be exactly the sub of member variables. The /Zp compiler option and the pack pragma affect alignment boundaries for members. Sizeof never returns 0. Sizeof operator cannot be used with functions, bit fields, void type, dynamically allocated arrays, external arrays, etc. 10 If I have a method foo(MyClass *arrayPointers[]), how do I initialize arrayPointer as an arg? MyClass *arrayPointers = NULL; foo(&arrayPointers); 11 What is pkg-config? It's a tool for specifying compiler command-line options. [PC] 12 What's the difference between main() and _tmain() generated by VC? In VC, _tmain may be translated to wmain() if you use unicode, otherwise it's translated to main() 13 cout is not a member of std Need #include <iostream> 14 C++ forbids declaration of vector with no type include <vector> 15 undefined reference to "function name" Linker couldn't find your method to link with. This usually means some .o files are missing. Check your make file and make sure that you have all source files inclueded when you compile. 16 expected unqualified-id before xxx in abc.h Could be many reasons, one hard-to-find one could be caused by missing semi-colon after you finish specifying a class 17 invalid conversion from const char* to char* Converting a const char* to char* leads to undefined behavior. You need to convert const char* to char* with strcpy. char *buf = new char[GetUser().size()]; strcpy(buf, GetUser().c_str()); char* userName = buf; [CG] 18 How do I convert a C++ string vector to a const char* array? const char** Utils::StrVector2ConstCharArray(vector<string> v) { int size = v.size(); const char** result = new const char*[size]; for(int i=0; i<size; i++) { result[i] = v.at(i).c_str(); } return result; } 19 debug assertion failed str!=NULL in fprintf.c Check your params to vfprintf and see if any one of them is NULL. For example, file handle has to be initialized. 20 error PRJ0003 : Error spawning 'cl.exe In visualstudio, Tools --> Options -> Projects -> VC++ directories. Add your cl.exe directory in. 21 fatal error LNK1112: module machine type 'x64' conflicts with target machine type 'X86' your cl.exe is of a different version from your target config. Check your C:\Program Files\Microsoft Visual Studio 9.0\VC\bin directory, and make sure you are running the correct cl.exe (32 bit or 64bit). If you are seeing this problem with Visual Studio 2008 on vista, it's not your fault. Somehow VS2008 thinks your system is 64bit and doesn't install the 32 bit cl.exe at all. In those cases, you could just try to fix this by copying Microsoft Visual Studio 9.0\VC\bin from another host.[SM] 22 How do I set command line parameter when debugging my programs in visual studio? Project->Properties->Debugging->Command Arguments [A] 23 How do I set environment variables in visual studio? Project->Properties->Debugging->Environment, add Name=Value lines into the box, for example PATH=C:\aaa;%PATH 24 There are no conversions to array types, although there are conversions to references or pointers to arrays If you do "char *a[] = new char*[10]", you see this error message, don't be fooled by *'s or pointers, this is a plain array issue: you can't assign arrays. For example, you'll get the same error if you do the following int a[] = new int[10] You'll need to use a loop to assign the elements one by one. 25 Why do I need STL? STL is Standard Template Library. It was originally proposed by SGI, and then adopted as part of the standard C++ library, although there are things that are in CGI STL but not c++ standard STL and vice versa. STL library contains a set of containers and algorithm. STL is very generic and therefore heavily parameterized. Almost every class in STL is a template.CGI http://www.sgi.com/tech/stl/stl_introduction.html CGI STL contains containers vector, list, deque, set, multiset, map, multimap, hash_set, hash_multiset, hash_map, and hash_multimap, as well as a bunch of other containers, iterators and algorithms. For a full list of objects in CGI STL, see http://www.sgi.com/tech/stl/table_of_contents.html. C++ standard STL has containers: vector, deque, list, map, set, stack, queue, bitset and algorithm, functional, iterator Aside from being general purpose and having commonly used algorithms wrapped in, STL also takes memory management off your hands. For example, std::vector is smilar to int[], however when using std::vector, you don't have to worry anything about memory management, the STL template handles that. Comments References[A] http://www.geekpedia.com/KB30_How-can-I-pass-command-line-arguments-while-debugging-within-Visual-Studio-.NET.html[CG] http://www.codeguru.com/forum/printthread.php?t=374984[CPR] http://www.cprogramming.com/tutorial/initialization-lists-c++.html[DEVX] http://www.devx.com/tips/Tip/12527[EX] http://www.exforsys.com/tutorials/c-plus-plus/c-pure-virtual-function-and-base-class.html[IF] http://www.informit.com/guides/content.aspx?g=cplusplus&seqNum=142[PC] http://pkg-config.freedesktop.org/wiki/[SM] http://social.msdn.microsoft.com/forums/en-US/vcplus2008prerelease/thread/a6eb88c0-5b17-4811-ba08-c4e753c4d039/
Size of can correctly return size of variables of any atomic data type. If applied to a class, struct, or union, sizeof returns the number of bytes in an object of that type plus any padding added to align members on word boundaries. So the result might not be exactly the sub of member variables. The /Zp compiler option and the pack pragma affect alignment boundaries for members. Sizeof never returns 0.
Sizeof operator cannot be used with functions, bit fields, void type, dynamically allocated arrays, external arrays, etc.
10 If I have a method foo(MyClass *arrayPointers[]), how do I initialize arrayPointer as an arg? MyClass *arrayPointers = NULL; foo(&arrayPointers); 11 What is pkg-config? It's a tool for specifying compiler command-line options. [PC] 12 What's the difference between main() and _tmain() generated by VC? In VC, _tmain may be translated to wmain() if you use unicode, otherwise it's translated to main() 13 cout is not a member of std Need #include <iostream> 14 C++ forbids declaration of vector with no type include <vector> 15 undefined reference to "function name" Linker couldn't find your method to link with. This usually means some .o files are missing. Check your make file and make sure that you have all source files inclueded when you compile. 16 expected unqualified-id before xxx in abc.h Could be many reasons, one hard-to-find one could be caused by missing semi-colon after you finish specifying a class 17 invalid conversion from const char* to char* Converting a const char* to char* leads to undefined behavior. You need to convert const char* to char* with strcpy. char *buf = new char[GetUser().size()]; strcpy(buf, GetUser().c_str()); char* userName = buf; [CG] 18 How do I convert a C++ string vector to a const char* array? const char** Utils::StrVector2ConstCharArray(vector<string> v) { int size = v.size(); const char** result = new const char*[size]; for(int i=0; i<size; i++) { result[i] = v.at(i).c_str(); } return result; } 19 debug assertion failed str!=NULL in fprintf.c Check your params to vfprintf and see if any one of them is NULL. For example, file handle has to be initialized. 20 error PRJ0003 : Error spawning 'cl.exe In visualstudio, Tools --> Options -> Projects -> VC++ directories. Add your cl.exe directory in. 21 fatal error LNK1112: module machine type 'x64' conflicts with target machine type 'X86' your cl.exe is of a different version from your target config. Check your C:\Program Files\Microsoft Visual Studio 9.0\VC\bin directory, and make sure you are running the correct cl.exe (32 bit or 64bit). If you are seeing this problem with Visual Studio 2008 on vista, it's not your fault. Somehow VS2008 thinks your system is 64bit and doesn't install the 32 bit cl.exe at all. In those cases, you could just try to fix this by copying Microsoft Visual Studio 9.0\VC\bin from another host.[SM] 22 How do I set command line parameter when debugging my programs in visual studio? Project->Properties->Debugging->Command Arguments [A] 23 How do I set environment variables in visual studio? Project->Properties->Debugging->Environment, add Name=Value lines into the box, for example PATH=C:\aaa;%PATH 24 There are no conversions to array types, although there are conversions to references or pointers to arrays If you do "char *a[] = new char*[10]", you see this error message, don't be fooled by *'s or pointers, this is a plain array issue: you can't assign arrays. For example, you'll get the same error if you do the following int a[] = new int[10] You'll need to use a loop to assign the elements one by one. 25 Why do I need STL? STL is Standard Template Library. It was originally proposed by SGI, and then adopted as part of the standard C++ library, although there are things that are in CGI STL but not c++ standard STL and vice versa. STL library contains a set of containers and algorithm. STL is very generic and therefore heavily parameterized. Almost every class in STL is a template.CGI http://www.sgi.com/tech/stl/stl_introduction.html CGI STL contains containers vector, list, deque, set, multiset, map, multimap, hash_set, hash_multiset, hash_map, and hash_multimap, as well as a bunch of other containers, iterators and algorithms. For a full list of objects in CGI STL, see http://www.sgi.com/tech/stl/table_of_contents.html. C++ standard STL has containers: vector, deque, list, map, set, stack, queue, bitset and algorithm, functional, iterator Aside from being general purpose and having commonly used algorithms wrapped in, STL also takes memory management off your hands. For example, std::vector is smilar to int[], however when using std::vector, you don't have to worry anything about memory management, the STL template handles that. Comments References[A] http://www.geekpedia.com/KB30_How-can-I-pass-command-line-arguments-while-debugging-within-Visual-Studio-.NET.html[CG] http://www.codeguru.com/forum/printthread.php?t=374984[CPR] http://www.cprogramming.com/tutorial/initialization-lists-c++.html[DEVX] http://www.devx.com/tips/Tip/12527[EX] http://www.exforsys.com/tutorials/c-plus-plus/c-pure-virtual-function-and-base-class.html[IF] http://www.informit.com/guides/content.aspx?g=cplusplus&seqNum=142[PC] http://pkg-config.freedesktop.org/wiki/[SM] http://social.msdn.microsoft.com/forums/en-US/vcplus2008prerelease/thread/a6eb88c0-5b17-4811-ba08-c4e753c4d039/
MyClass *arrayPointers = NULL; foo(&arrayPointers);
11 What is pkg-config? It's a tool for specifying compiler command-line options. [PC] 12 What's the difference between main() and _tmain() generated by VC? In VC, _tmain may be translated to wmain() if you use unicode, otherwise it's translated to main() 13 cout is not a member of std Need #include <iostream> 14 C++ forbids declaration of vector with no type include <vector> 15 undefined reference to "function name" Linker couldn't find your method to link with. This usually means some .o files are missing. Check your make file and make sure that you have all source files inclueded when you compile. 16 expected unqualified-id before xxx in abc.h Could be many reasons, one hard-to-find one could be caused by missing semi-colon after you finish specifying a class 17 invalid conversion from const char* to char* Converting a const char* to char* leads to undefined behavior. You need to convert const char* to char* with strcpy. char *buf = new char[GetUser().size()]; strcpy(buf, GetUser().c_str()); char* userName = buf; [CG] 18 How do I convert a C++ string vector to a const char* array? const char** Utils::StrVector2ConstCharArray(vector<string> v) { int size = v.size(); const char** result = new const char*[size]; for(int i=0; i<size; i++) { result[i] = v.at(i).c_str(); } return result; } 19 debug assertion failed str!=NULL in fprintf.c Check your params to vfprintf and see if any one of them is NULL. For example, file handle has to be initialized. 20 error PRJ0003 : Error spawning 'cl.exe In visualstudio, Tools --> Options -> Projects -> VC++ directories. Add your cl.exe directory in. 21 fatal error LNK1112: module machine type 'x64' conflicts with target machine type 'X86' your cl.exe is of a different version from your target config. Check your C:\Program Files\Microsoft Visual Studio 9.0\VC\bin directory, and make sure you are running the correct cl.exe (32 bit or 64bit). If you are seeing this problem with Visual Studio 2008 on vista, it's not your fault. Somehow VS2008 thinks your system is 64bit and doesn't install the 32 bit cl.exe at all. In those cases, you could just try to fix this by copying Microsoft Visual Studio 9.0\VC\bin from another host.[SM] 22 How do I set command line parameter when debugging my programs in visual studio? Project->Properties->Debugging->Command Arguments [A] 23 How do I set environment variables in visual studio? Project->Properties->Debugging->Environment, add Name=Value lines into the box, for example PATH=C:\aaa;%PATH 24 There are no conversions to array types, although there are conversions to references or pointers to arrays If you do "char *a[] = new char*[10]", you see this error message, don't be fooled by *'s or pointers, this is a plain array issue: you can't assign arrays. For example, you'll get the same error if you do the following int a[] = new int[10] You'll need to use a loop to assign the elements one by one. 25 Why do I need STL? STL is Standard Template Library. It was originally proposed by SGI, and then adopted as part of the standard C++ library, although there are things that are in CGI STL but not c++ standard STL and vice versa. STL library contains a set of containers and algorithm. STL is very generic and therefore heavily parameterized. Almost every class in STL is a template.CGI http://www.sgi.com/tech/stl/stl_introduction.html CGI STL contains containers vector, list, deque, set, multiset, map, multimap, hash_set, hash_multiset, hash_map, and hash_multimap, as well as a bunch of other containers, iterators and algorithms. For a full list of objects in CGI STL, see http://www.sgi.com/tech/stl/table_of_contents.html. C++ standard STL has containers: vector, deque, list, map, set, stack, queue, bitset and algorithm, functional, iterator Aside from being general purpose and having commonly used algorithms wrapped in, STL also takes memory management off your hands. For example, std::vector is smilar to int[], however when using std::vector, you don't have to worry anything about memory management, the STL template handles that. Comments References[A] http://www.geekpedia.com/KB30_How-can-I-pass-command-line-arguments-while-debugging-within-Visual-Studio-.NET.html[CG] http://www.codeguru.com/forum/printthread.php?t=374984[CPR] http://www.cprogramming.com/tutorial/initialization-lists-c++.html[DEVX] http://www.devx.com/tips/Tip/12527[EX] http://www.exforsys.com/tutorials/c-plus-plus/c-pure-virtual-function-and-base-class.html[IF] http://www.informit.com/guides/content.aspx?g=cplusplus&seqNum=142[PC] http://pkg-config.freedesktop.org/wiki/[SM] http://social.msdn.microsoft.com/forums/en-US/vcplus2008prerelease/thread/a6eb88c0-5b17-4811-ba08-c4e753c4d039/
It's a tool for specifying compiler command-line options. [PC] 12 What's the difference between main() and _tmain() generated by VC? In VC, _tmain may be translated to wmain() if you use unicode, otherwise it's translated to main() 13 cout is not a member of std Need #include <iostream> 14 C++ forbids declaration of vector with no type include <vector> 15 undefined reference to "function name" Linker couldn't find your method to link with. This usually means some .o files are missing. Check your make file and make sure that you have all source files inclueded when you compile. 16 expected unqualified-id before xxx in abc.h Could be many reasons, one hard-to-find one could be caused by missing semi-colon after you finish specifying a class 17 invalid conversion from const char* to char* Converting a const char* to char* leads to undefined behavior. You need to convert const char* to char* with strcpy. char *buf = new char[GetUser().size()]; strcpy(buf, GetUser().c_str()); char* userName = buf; [CG] 18 How do I convert a C++ string vector to a const char* array? const char** Utils::StrVector2ConstCharArray(vector<string> v) { int size = v.size(); const char** result = new const char*[size]; for(int i=0; i<size; i++) { result[i] = v.at(i).c_str(); } return result; } 19 debug assertion failed str!=NULL in fprintf.c Check your params to vfprintf and see if any one of them is NULL. For example, file handle has to be initialized. 20 error PRJ0003 : Error spawning 'cl.exe In visualstudio, Tools --> Options -> Projects -> VC++ directories. Add your cl.exe directory in. 21 fatal error LNK1112: module machine type 'x64' conflicts with target machine type 'X86' your cl.exe is of a different version from your target config. Check your C:\Program Files\Microsoft Visual Studio 9.0\VC\bin directory, and make sure you are running the correct cl.exe (32 bit or 64bit). If you are seeing this problem with Visual Studio 2008 on vista, it's not your fault. Somehow VS2008 thinks your system is 64bit and doesn't install the 32 bit cl.exe at all. In those cases, you could just try to fix this by copying Microsoft Visual Studio 9.0\VC\bin from another host.[SM] 22 How do I set command line parameter when debugging my programs in visual studio? Project->Properties->Debugging->Command Arguments [A] 23 How do I set environment variables in visual studio? Project->Properties->Debugging->Environment, add Name=Value lines into the box, for example PATH=C:\aaa;%PATH 24 There are no conversions to array types, although there are conversions to references or pointers to arrays If you do "char *a[] = new char*[10]", you see this error message, don't be fooled by *'s or pointers, this is a plain array issue: you can't assign arrays. For example, you'll get the same error if you do the following int a[] = new int[10] You'll need to use a loop to assign the elements one by one. 25 Why do I need STL? STL is Standard Template Library. It was originally proposed by SGI, and then adopted as part of the standard C++ library, although there are things that are in CGI STL but not c++ standard STL and vice versa. STL library contains a set of containers and algorithm. STL is very generic and therefore heavily parameterized. Almost every class in STL is a template.CGI http://www.sgi.com/tech/stl/stl_introduction.html CGI STL contains containers vector, list, deque, set, multiset, map, multimap, hash_set, hash_multiset, hash_map, and hash_multimap, as well as a bunch of other containers, iterators and algorithms. For a full list of objects in CGI STL, see http://www.sgi.com/tech/stl/table_of_contents.html. C++ standard STL has containers: vector, deque, list, map, set, stack, queue, bitset and algorithm, functional, iterator Aside from being general purpose and having commonly used algorithms wrapped in, STL also takes memory management off your hands. For example, std::vector is smilar to int[], however when using std::vector, you don't have to worry anything about memory management, the STL template handles that. Comments References[A] http://www.geekpedia.com/KB30_How-can-I-pass-command-line-arguments-while-debugging-within-Visual-Studio-.NET.html[CG] http://www.codeguru.com/forum/printthread.php?t=374984[CPR] http://www.cprogramming.com/tutorial/initialization-lists-c++.html[DEVX] http://www.devx.com/tips/Tip/12527[EX] http://www.exforsys.com/tutorials/c-plus-plus/c-pure-virtual-function-and-base-class.html[IF] http://www.informit.com/guides/content.aspx?g=cplusplus&seqNum=142[PC] http://pkg-config.freedesktop.org/wiki/[SM] http://social.msdn.microsoft.com/forums/en-US/vcplus2008prerelease/thread/a6eb88c0-5b17-4811-ba08-c4e753c4d039/
In VC, _tmain may be translated to wmain() if you use unicode, otherwise it's translated to main()
13 cout is not a member of std Need #include <iostream> 14 C++ forbids declaration of vector with no type include <vector> 15 undefined reference to "function name" Linker couldn't find your method to link with. This usually means some .o files are missing. Check your make file and make sure that you have all source files inclueded when you compile. 16 expected unqualified-id before xxx in abc.h Could be many reasons, one hard-to-find one could be caused by missing semi-colon after you finish specifying a class 17 invalid conversion from const char* to char* Converting a const char* to char* leads to undefined behavior. You need to convert const char* to char* with strcpy. char *buf = new char[GetUser().size()]; strcpy(buf, GetUser().c_str()); char* userName = buf; [CG] 18 How do I convert a C++ string vector to a const char* array? const char** Utils::StrVector2ConstCharArray(vector<string> v) { int size = v.size(); const char** result = new const char*[size]; for(int i=0; i<size; i++) { result[i] = v.at(i).c_str(); } return result; } 19 debug assertion failed str!=NULL in fprintf.c Check your params to vfprintf and see if any one of them is NULL. For example, file handle has to be initialized. 20 error PRJ0003 : Error spawning 'cl.exe In visualstudio, Tools --> Options -> Projects -> VC++ directories. Add your cl.exe directory in. 21 fatal error LNK1112: module machine type 'x64' conflicts with target machine type 'X86' your cl.exe is of a different version from your target config. Check your C:\Program Files\Microsoft Visual Studio 9.0\VC\bin directory, and make sure you are running the correct cl.exe (32 bit or 64bit). If you are seeing this problem with Visual Studio 2008 on vista, it's not your fault. Somehow VS2008 thinks your system is 64bit and doesn't install the 32 bit cl.exe at all. In those cases, you could just try to fix this by copying Microsoft Visual Studio 9.0\VC\bin from another host.[SM] 22 How do I set command line parameter when debugging my programs in visual studio? Project->Properties->Debugging->Command Arguments [A] 23 How do I set environment variables in visual studio? Project->Properties->Debugging->Environment, add Name=Value lines into the box, for example PATH=C:\aaa;%PATH 24 There are no conversions to array types, although there are conversions to references or pointers to arrays If you do "char *a[] = new char*[10]", you see this error message, don't be fooled by *'s or pointers, this is a plain array issue: you can't assign arrays. For example, you'll get the same error if you do the following int a[] = new int[10] You'll need to use a loop to assign the elements one by one. 25 Why do I need STL? STL is Standard Template Library. It was originally proposed by SGI, and then adopted as part of the standard C++ library, although there are things that are in CGI STL but not c++ standard STL and vice versa. STL library contains a set of containers and algorithm. STL is very generic and therefore heavily parameterized. Almost every class in STL is a template.CGI http://www.sgi.com/tech/stl/stl_introduction.html CGI STL contains containers vector, list, deque, set, multiset, map, multimap, hash_set, hash_multiset, hash_map, and hash_multimap, as well as a bunch of other containers, iterators and algorithms. For a full list of objects in CGI STL, see http://www.sgi.com/tech/stl/table_of_contents.html. C++ standard STL has containers: vector, deque, list, map, set, stack, queue, bitset and algorithm, functional, iterator Aside from being general purpose and having commonly used algorithms wrapped in, STL also takes memory management off your hands. For example, std::vector is smilar to int[], however when using std::vector, you don't have to worry anything about memory management, the STL template handles that. Comments References[A] http://www.geekpedia.com/KB30_How-can-I-pass-command-line-arguments-while-debugging-within-Visual-Studio-.NET.html[CG] http://www.codeguru.com/forum/printthread.php?t=374984[CPR] http://www.cprogramming.com/tutorial/initialization-lists-c++.html[DEVX] http://www.devx.com/tips/Tip/12527[EX] http://www.exforsys.com/tutorials/c-plus-plus/c-pure-virtual-function-and-base-class.html[IF] http://www.informit.com/guides/content.aspx?g=cplusplus&seqNum=142[PC] http://pkg-config.freedesktop.org/wiki/[SM] http://social.msdn.microsoft.com/forums/en-US/vcplus2008prerelease/thread/a6eb88c0-5b17-4811-ba08-c4e753c4d039/
Need
#include <iostream>
include <vector>
15 undefined reference to "function name" Linker couldn't find your method to link with. This usually means some .o files are missing. Check your make file and make sure that you have all source files inclueded when you compile. 16 expected unqualified-id before xxx in abc.h Could be many reasons, one hard-to-find one could be caused by missing semi-colon after you finish specifying a class 17 invalid conversion from const char* to char* Converting a const char* to char* leads to undefined behavior. You need to convert const char* to char* with strcpy. char *buf = new char[GetUser().size()]; strcpy(buf, GetUser().c_str()); char* userName = buf; [CG] 18 How do I convert a C++ string vector to a const char* array? const char** Utils::StrVector2ConstCharArray(vector<string> v) { int size = v.size(); const char** result = new const char*[size]; for(int i=0; i<size; i++) { result[i] = v.at(i).c_str(); } return result; } 19 debug assertion failed str!=NULL in fprintf.c Check your params to vfprintf and see if any one of them is NULL. For example, file handle has to be initialized. 20 error PRJ0003 : Error spawning 'cl.exe In visualstudio, Tools --> Options -> Projects -> VC++ directories. Add your cl.exe directory in. 21 fatal error LNK1112: module machine type 'x64' conflicts with target machine type 'X86' your cl.exe is of a different version from your target config. Check your C:\Program Files\Microsoft Visual Studio 9.0\VC\bin directory, and make sure you are running the correct cl.exe (32 bit or 64bit). If you are seeing this problem with Visual Studio 2008 on vista, it's not your fault. Somehow VS2008 thinks your system is 64bit and doesn't install the 32 bit cl.exe at all. In those cases, you could just try to fix this by copying Microsoft Visual Studio 9.0\VC\bin from another host.[SM] 22 How do I set command line parameter when debugging my programs in visual studio? Project->Properties->Debugging->Command Arguments [A] 23 How do I set environment variables in visual studio? Project->Properties->Debugging->Environment, add Name=Value lines into the box, for example PATH=C:\aaa;%PATH 24 There are no conversions to array types, although there are conversions to references or pointers to arrays If you do "char *a[] = new char*[10]", you see this error message, don't be fooled by *'s or pointers, this is a plain array issue: you can't assign arrays. For example, you'll get the same error if you do the following int a[] = new int[10] You'll need to use a loop to assign the elements one by one. 25 Why do I need STL? STL is Standard Template Library. It was originally proposed by SGI, and then adopted as part of the standard C++ library, although there are things that are in CGI STL but not c++ standard STL and vice versa. STL library contains a set of containers and algorithm. STL is very generic and therefore heavily parameterized. Almost every class in STL is a template.CGI http://www.sgi.com/tech/stl/stl_introduction.html CGI STL contains containers vector, list, deque, set, multiset, map, multimap, hash_set, hash_multiset, hash_map, and hash_multimap, as well as a bunch of other containers, iterators and algorithms. For a full list of objects in CGI STL, see http://www.sgi.com/tech/stl/table_of_contents.html. C++ standard STL has containers: vector, deque, list, map, set, stack, queue, bitset and algorithm, functional, iterator Aside from being general purpose and having commonly used algorithms wrapped in, STL also takes memory management off your hands. For example, std::vector is smilar to int[], however when using std::vector, you don't have to worry anything about memory management, the STL template handles that. Comments References[A] http://www.geekpedia.com/KB30_How-can-I-pass-command-line-arguments-while-debugging-within-Visual-Studio-.NET.html[CG] http://www.codeguru.com/forum/printthread.php?t=374984[CPR] http://www.cprogramming.com/tutorial/initialization-lists-c++.html[DEVX] http://www.devx.com/tips/Tip/12527[EX] http://www.exforsys.com/tutorials/c-plus-plus/c-pure-virtual-function-and-base-class.html[IF] http://www.informit.com/guides/content.aspx?g=cplusplus&seqNum=142[PC] http://pkg-config.freedesktop.org/wiki/[SM] http://social.msdn.microsoft.com/forums/en-US/vcplus2008prerelease/thread/a6eb88c0-5b17-4811-ba08-c4e753c4d039/
Linker couldn't find your method to link with. This usually means some .o files are missing. Check your make file and make sure that you have all source files inclueded when you compile.
16 expected unqualified-id before xxx in abc.h Could be many reasons, one hard-to-find one could be caused by missing semi-colon after you finish specifying a class 17 invalid conversion from const char* to char* Converting a const char* to char* leads to undefined behavior. You need to convert const char* to char* with strcpy. char *buf = new char[GetUser().size()]; strcpy(buf, GetUser().c_str()); char* userName = buf; [CG] 18 How do I convert a C++ string vector to a const char* array? const char** Utils::StrVector2ConstCharArray(vector<string> v) { int size = v.size(); const char** result = new const char*[size]; for(int i=0; i<size; i++) { result[i] = v.at(i).c_str(); } return result; } 19 debug assertion failed str!=NULL in fprintf.c Check your params to vfprintf and see if any one of them is NULL. For example, file handle has to be initialized. 20 error PRJ0003 : Error spawning 'cl.exe In visualstudio, Tools --> Options -> Projects -> VC++ directories. Add your cl.exe directory in. 21 fatal error LNK1112: module machine type 'x64' conflicts with target machine type 'X86' your cl.exe is of a different version from your target config. Check your C:\Program Files\Microsoft Visual Studio 9.0\VC\bin directory, and make sure you are running the correct cl.exe (32 bit or 64bit). If you are seeing this problem with Visual Studio 2008 on vista, it's not your fault. Somehow VS2008 thinks your system is 64bit and doesn't install the 32 bit cl.exe at all. In those cases, you could just try to fix this by copying Microsoft Visual Studio 9.0\VC\bin from another host.[SM] 22 How do I set command line parameter when debugging my programs in visual studio? Project->Properties->Debugging->Command Arguments [A] 23 How do I set environment variables in visual studio? Project->Properties->Debugging->Environment, add Name=Value lines into the box, for example PATH=C:\aaa;%PATH 24 There are no conversions to array types, although there are conversions to references or pointers to arrays If you do "char *a[] = new char*[10]", you see this error message, don't be fooled by *'s or pointers, this is a plain array issue: you can't assign arrays. For example, you'll get the same error if you do the following int a[] = new int[10] You'll need to use a loop to assign the elements one by one. 25 Why do I need STL? STL is Standard Template Library. It was originally proposed by SGI, and then adopted as part of the standard C++ library, although there are things that are in CGI STL but not c++ standard STL and vice versa. STL library contains a set of containers and algorithm. STL is very generic and therefore heavily parameterized. Almost every class in STL is a template.CGI http://www.sgi.com/tech/stl/stl_introduction.html CGI STL contains containers vector, list, deque, set, multiset, map, multimap, hash_set, hash_multiset, hash_map, and hash_multimap, as well as a bunch of other containers, iterators and algorithms. For a full list of objects in CGI STL, see http://www.sgi.com/tech/stl/table_of_contents.html. C++ standard STL has containers: vector, deque, list, map, set, stack, queue, bitset and algorithm, functional, iterator Aside from being general purpose and having commonly used algorithms wrapped in, STL also takes memory management off your hands. For example, std::vector is smilar to int[], however when using std::vector, you don't have to worry anything about memory management, the STL template handles that. Comments References[A] http://www.geekpedia.com/KB30_How-can-I-pass-command-line-arguments-while-debugging-within-Visual-Studio-.NET.html[CG] http://www.codeguru.com/forum/printthread.php?t=374984[CPR] http://www.cprogramming.com/tutorial/initialization-lists-c++.html[DEVX] http://www.devx.com/tips/Tip/12527[EX] http://www.exforsys.com/tutorials/c-plus-plus/c-pure-virtual-function-and-base-class.html[IF] http://www.informit.com/guides/content.aspx?g=cplusplus&seqNum=142[PC] http://pkg-config.freedesktop.org/wiki/[SM] http://social.msdn.microsoft.com/forums/en-US/vcplus2008prerelease/thread/a6eb88c0-5b17-4811-ba08-c4e753c4d039/
Could be many reasons, one hard-to-find one could be caused by missing semi-colon after you finish specifying a class
17 invalid conversion from const char* to char* Converting a const char* to char* leads to undefined behavior. You need to convert const char* to char* with strcpy. char *buf = new char[GetUser().size()]; strcpy(buf, GetUser().c_str()); char* userName = buf; [CG] 18 How do I convert a C++ string vector to a const char* array? const char** Utils::StrVector2ConstCharArray(vector<string> v) { int size = v.size(); const char** result = new const char*[size]; for(int i=0; i<size; i++) { result[i] = v.at(i).c_str(); } return result; } 19 debug assertion failed str!=NULL in fprintf.c Check your params to vfprintf and see if any one of them is NULL. For example, file handle has to be initialized. 20 error PRJ0003 : Error spawning 'cl.exe In visualstudio, Tools --> Options -> Projects -> VC++ directories. Add your cl.exe directory in. 21 fatal error LNK1112: module machine type 'x64' conflicts with target machine type 'X86' your cl.exe is of a different version from your target config. Check your C:\Program Files\Microsoft Visual Studio 9.0\VC\bin directory, and make sure you are running the correct cl.exe (32 bit or 64bit). If you are seeing this problem with Visual Studio 2008 on vista, it's not your fault. Somehow VS2008 thinks your system is 64bit and doesn't install the 32 bit cl.exe at all. In those cases, you could just try to fix this by copying Microsoft Visual Studio 9.0\VC\bin from another host.[SM] 22 How do I set command line parameter when debugging my programs in visual studio? Project->Properties->Debugging->Command Arguments [A] 23 How do I set environment variables in visual studio? Project->Properties->Debugging->Environment, add Name=Value lines into the box, for example PATH=C:\aaa;%PATH 24 There are no conversions to array types, although there are conversions to references or pointers to arrays If you do "char *a[] = new char*[10]", you see this error message, don't be fooled by *'s or pointers, this is a plain array issue: you can't assign arrays. For example, you'll get the same error if you do the following int a[] = new int[10] You'll need to use a loop to assign the elements one by one. 25 Why do I need STL? STL is Standard Template Library. It was originally proposed by SGI, and then adopted as part of the standard C++ library, although there are things that are in CGI STL but not c++ standard STL and vice versa. STL library contains a set of containers and algorithm. STL is very generic and therefore heavily parameterized. Almost every class in STL is a template.CGI http://www.sgi.com/tech/stl/stl_introduction.html CGI STL contains containers vector, list, deque, set, multiset, map, multimap, hash_set, hash_multiset, hash_map, and hash_multimap, as well as a bunch of other containers, iterators and algorithms. For a full list of objects in CGI STL, see http://www.sgi.com/tech/stl/table_of_contents.html. C++ standard STL has containers: vector, deque, list, map, set, stack, queue, bitset and algorithm, functional, iterator Aside from being general purpose and having commonly used algorithms wrapped in, STL also takes memory management off your hands. For example, std::vector is smilar to int[], however when using std::vector, you don't have to worry anything about memory management, the STL template handles that. Comments References[A] http://www.geekpedia.com/KB30_How-can-I-pass-command-line-arguments-while-debugging-within-Visual-Studio-.NET.html[CG] http://www.codeguru.com/forum/printthread.php?t=374984[CPR] http://www.cprogramming.com/tutorial/initialization-lists-c++.html[DEVX] http://www.devx.com/tips/Tip/12527[EX] http://www.exforsys.com/tutorials/c-plus-plus/c-pure-virtual-function-and-base-class.html[IF] http://www.informit.com/guides/content.aspx?g=cplusplus&seqNum=142[PC] http://pkg-config.freedesktop.org/wiki/[SM] http://social.msdn.microsoft.com/forums/en-US/vcplus2008prerelease/thread/a6eb88c0-5b17-4811-ba08-c4e753c4d039/
Converting a const char* to char* leads to undefined behavior. You need to convert const char* to char* with strcpy.
char *buf = new char[GetUser().size()]; strcpy(buf, GetUser().c_str()); char* userName = buf;
[CG] 18 How do I convert a C++ string vector to a const char* array? const char** Utils::StrVector2ConstCharArray(vector<string> v) { int size = v.size(); const char** result = new const char*[size]; for(int i=0; i<size; i++) { result[i] = v.at(i).c_str(); } return result; } 19 debug assertion failed str!=NULL in fprintf.c Check your params to vfprintf and see if any one of them is NULL. For example, file handle has to be initialized. 20 error PRJ0003 : Error spawning 'cl.exe In visualstudio, Tools --> Options -> Projects -> VC++ directories. Add your cl.exe directory in. 21 fatal error LNK1112: module machine type 'x64' conflicts with target machine type 'X86' your cl.exe is of a different version from your target config. Check your C:\Program Files\Microsoft Visual Studio 9.0\VC\bin directory, and make sure you are running the correct cl.exe (32 bit or 64bit). If you are seeing this problem with Visual Studio 2008 on vista, it's not your fault. Somehow VS2008 thinks your system is 64bit and doesn't install the 32 bit cl.exe at all. In those cases, you could just try to fix this by copying Microsoft Visual Studio 9.0\VC\bin from another host.[SM] 22 How do I set command line parameter when debugging my programs in visual studio? Project->Properties->Debugging->Command Arguments [A] 23 How do I set environment variables in visual studio? Project->Properties->Debugging->Environment, add Name=Value lines into the box, for example PATH=C:\aaa;%PATH 24 There are no conversions to array types, although there are conversions to references or pointers to arrays If you do "char *a[] = new char*[10]", you see this error message, don't be fooled by *'s or pointers, this is a plain array issue: you can't assign arrays. For example, you'll get the same error if you do the following int a[] = new int[10] You'll need to use a loop to assign the elements one by one. 25 Why do I need STL? STL is Standard Template Library. It was originally proposed by SGI, and then adopted as part of the standard C++ library, although there are things that are in CGI STL but not c++ standard STL and vice versa. STL library contains a set of containers and algorithm. STL is very generic and therefore heavily parameterized. Almost every class in STL is a template.CGI http://www.sgi.com/tech/stl/stl_introduction.html CGI STL contains containers vector, list, deque, set, multiset, map, multimap, hash_set, hash_multiset, hash_map, and hash_multimap, as well as a bunch of other containers, iterators and algorithms. For a full list of objects in CGI STL, see http://www.sgi.com/tech/stl/table_of_contents.html. C++ standard STL has containers: vector, deque, list, map, set, stack, queue, bitset and algorithm, functional, iterator Aside from being general purpose and having commonly used algorithms wrapped in, STL also takes memory management off your hands. For example, std::vector is smilar to int[], however when using std::vector, you don't have to worry anything about memory management, the STL template handles that. Comments References[A] http://www.geekpedia.com/KB30_How-can-I-pass-command-line-arguments-while-debugging-within-Visual-Studio-.NET.html[CG] http://www.codeguru.com/forum/printthread.php?t=374984[CPR] http://www.cprogramming.com/tutorial/initialization-lists-c++.html[DEVX] http://www.devx.com/tips/Tip/12527[EX] http://www.exforsys.com/tutorials/c-plus-plus/c-pure-virtual-function-and-base-class.html[IF] http://www.informit.com/guides/content.aspx?g=cplusplus&seqNum=142[PC] http://pkg-config.freedesktop.org/wiki/[SM] http://social.msdn.microsoft.com/forums/en-US/vcplus2008prerelease/thread/a6eb88c0-5b17-4811-ba08-c4e753c4d039/
const char** Utils::StrVector2ConstCharArray(vector<string> v) { int size = v.size(); const char** result = new const char*[size]; for(int i=0; i<size; i++) { result[i] = v.at(i).c_str(); } return result; }
19 debug assertion failed str!=NULL in fprintf.c Check your params to vfprintf and see if any one of them is NULL. For example, file handle has to be initialized. 20 error PRJ0003 : Error spawning 'cl.exe In visualstudio, Tools --> Options -> Projects -> VC++ directories. Add your cl.exe directory in. 21 fatal error LNK1112: module machine type 'x64' conflicts with target machine type 'X86' your cl.exe is of a different version from your target config. Check your C:\Program Files\Microsoft Visual Studio 9.0\VC\bin directory, and make sure you are running the correct cl.exe (32 bit or 64bit). If you are seeing this problem with Visual Studio 2008 on vista, it's not your fault. Somehow VS2008 thinks your system is 64bit and doesn't install the 32 bit cl.exe at all. In those cases, you could just try to fix this by copying Microsoft Visual Studio 9.0\VC\bin from another host.[SM] 22 How do I set command line parameter when debugging my programs in visual studio? Project->Properties->Debugging->Command Arguments [A] 23 How do I set environment variables in visual studio? Project->Properties->Debugging->Environment, add Name=Value lines into the box, for example PATH=C:\aaa;%PATH 24 There are no conversions to array types, although there are conversions to references or pointers to arrays If you do "char *a[] = new char*[10]", you see this error message, don't be fooled by *'s or pointers, this is a plain array issue: you can't assign arrays. For example, you'll get the same error if you do the following int a[] = new int[10] You'll need to use a loop to assign the elements one by one. 25 Why do I need STL? STL is Standard Template Library. It was originally proposed by SGI, and then adopted as part of the standard C++ library, although there are things that are in CGI STL but not c++ standard STL and vice versa. STL library contains a set of containers and algorithm. STL is very generic and therefore heavily parameterized. Almost every class in STL is a template.CGI http://www.sgi.com/tech/stl/stl_introduction.html CGI STL contains containers vector, list, deque, set, multiset, map, multimap, hash_set, hash_multiset, hash_map, and hash_multimap, as well as a bunch of other containers, iterators and algorithms. For a full list of objects in CGI STL, see http://www.sgi.com/tech/stl/table_of_contents.html. C++ standard STL has containers: vector, deque, list, map, set, stack, queue, bitset and algorithm, functional, iterator Aside from being general purpose and having commonly used algorithms wrapped in, STL also takes memory management off your hands. For example, std::vector is smilar to int[], however when using std::vector, you don't have to worry anything about memory management, the STL template handles that. Comments References[A] http://www.geekpedia.com/KB30_How-can-I-pass-command-line-arguments-while-debugging-within-Visual-Studio-.NET.html[CG] http://www.codeguru.com/forum/printthread.php?t=374984[CPR] http://www.cprogramming.com/tutorial/initialization-lists-c++.html[DEVX] http://www.devx.com/tips/Tip/12527[EX] http://www.exforsys.com/tutorials/c-plus-plus/c-pure-virtual-function-and-base-class.html[IF] http://www.informit.com/guides/content.aspx?g=cplusplus&seqNum=142[PC] http://pkg-config.freedesktop.org/wiki/[SM] http://social.msdn.microsoft.com/forums/en-US/vcplus2008prerelease/thread/a6eb88c0-5b17-4811-ba08-c4e753c4d039/
Check your params to vfprintf and see if any one of them is NULL. For example, file handle has to be initialized.
20 error PRJ0003 : Error spawning 'cl.exe In visualstudio, Tools --> Options -> Projects -> VC++ directories. Add your cl.exe directory in. 21 fatal error LNK1112: module machine type 'x64' conflicts with target machine type 'X86' your cl.exe is of a different version from your target config. Check your C:\Program Files\Microsoft Visual Studio 9.0\VC\bin directory, and make sure you are running the correct cl.exe (32 bit or 64bit). If you are seeing this problem with Visual Studio 2008 on vista, it's not your fault. Somehow VS2008 thinks your system is 64bit and doesn't install the 32 bit cl.exe at all. In those cases, you could just try to fix this by copying Microsoft Visual Studio 9.0\VC\bin from another host.[SM] 22 How do I set command line parameter when debugging my programs in visual studio? Project->Properties->Debugging->Command Arguments [A] 23 How do I set environment variables in visual studio? Project->Properties->Debugging->Environment, add Name=Value lines into the box, for example PATH=C:\aaa;%PATH 24 There are no conversions to array types, although there are conversions to references or pointers to arrays If you do "char *a[] = new char*[10]", you see this error message, don't be fooled by *'s or pointers, this is a plain array issue: you can't assign arrays. For example, you'll get the same error if you do the following int a[] = new int[10] You'll need to use a loop to assign the elements one by one. 25 Why do I need STL? STL is Standard Template Library. It was originally proposed by SGI, and then adopted as part of the standard C++ library, although there are things that are in CGI STL but not c++ standard STL and vice versa. STL library contains a set of containers and algorithm. STL is very generic and therefore heavily parameterized. Almost every class in STL is a template.CGI http://www.sgi.com/tech/stl/stl_introduction.html CGI STL contains containers vector, list, deque, set, multiset, map, multimap, hash_set, hash_multiset, hash_map, and hash_multimap, as well as a bunch of other containers, iterators and algorithms. For a full list of objects in CGI STL, see http://www.sgi.com/tech/stl/table_of_contents.html. C++ standard STL has containers: vector, deque, list, map, set, stack, queue, bitset and algorithm, functional, iterator Aside from being general purpose and having commonly used algorithms wrapped in, STL also takes memory management off your hands. For example, std::vector is smilar to int[], however when using std::vector, you don't have to worry anything about memory management, the STL template handles that. Comments References[A] http://www.geekpedia.com/KB30_How-can-I-pass-command-line-arguments-while-debugging-within-Visual-Studio-.NET.html[CG] http://www.codeguru.com/forum/printthread.php?t=374984[CPR] http://www.cprogramming.com/tutorial/initialization-lists-c++.html[DEVX] http://www.devx.com/tips/Tip/12527[EX] http://www.exforsys.com/tutorials/c-plus-plus/c-pure-virtual-function-and-base-class.html[IF] http://www.informit.com/guides/content.aspx?g=cplusplus&seqNum=142[PC] http://pkg-config.freedesktop.org/wiki/[SM] http://social.msdn.microsoft.com/forums/en-US/vcplus2008prerelease/thread/a6eb88c0-5b17-4811-ba08-c4e753c4d039/
In visualstudio, Tools --> Options -> Projects -> VC++ directories. Add your cl.exe directory in.
21 fatal error LNK1112: module machine type 'x64' conflicts with target machine type 'X86' your cl.exe is of a different version from your target config. Check your C:\Program Files\Microsoft Visual Studio 9.0\VC\bin directory, and make sure you are running the correct cl.exe (32 bit or 64bit). If you are seeing this problem with Visual Studio 2008 on vista, it's not your fault. Somehow VS2008 thinks your system is 64bit and doesn't install the 32 bit cl.exe at all. In those cases, you could just try to fix this by copying Microsoft Visual Studio 9.0\VC\bin from another host.[SM] 22 How do I set command line parameter when debugging my programs in visual studio? Project->Properties->Debugging->Command Arguments [A] 23 How do I set environment variables in visual studio? Project->Properties->Debugging->Environment, add Name=Value lines into the box, for example PATH=C:\aaa;%PATH 24 There are no conversions to array types, although there are conversions to references or pointers to arrays If you do "char *a[] = new char*[10]", you see this error message, don't be fooled by *'s or pointers, this is a plain array issue: you can't assign arrays. For example, you'll get the same error if you do the following int a[] = new int[10] You'll need to use a loop to assign the elements one by one. 25 Why do I need STL? STL is Standard Template Library. It was originally proposed by SGI, and then adopted as part of the standard C++ library, although there are things that are in CGI STL but not c++ standard STL and vice versa. STL library contains a set of containers and algorithm. STL is very generic and therefore heavily parameterized. Almost every class in STL is a template.CGI http://www.sgi.com/tech/stl/stl_introduction.html CGI STL contains containers vector, list, deque, set, multiset, map, multimap, hash_set, hash_multiset, hash_map, and hash_multimap, as well as a bunch of other containers, iterators and algorithms. For a full list of objects in CGI STL, see http://www.sgi.com/tech/stl/table_of_contents.html. C++ standard STL has containers: vector, deque, list, map, set, stack, queue, bitset and algorithm, functional, iterator Aside from being general purpose and having commonly used algorithms wrapped in, STL also takes memory management off your hands. For example, std::vector is smilar to int[], however when using std::vector, you don't have to worry anything about memory management, the STL template handles that. Comments References[A] http://www.geekpedia.com/KB30_How-can-I-pass-command-line-arguments-while-debugging-within-Visual-Studio-.NET.html[CG] http://www.codeguru.com/forum/printthread.php?t=374984[CPR] http://www.cprogramming.com/tutorial/initialization-lists-c++.html[DEVX] http://www.devx.com/tips/Tip/12527[EX] http://www.exforsys.com/tutorials/c-plus-plus/c-pure-virtual-function-and-base-class.html[IF] http://www.informit.com/guides/content.aspx?g=cplusplus&seqNum=142[PC] http://pkg-config.freedesktop.org/wiki/[SM] http://social.msdn.microsoft.com/forums/en-US/vcplus2008prerelease/thread/a6eb88c0-5b17-4811-ba08-c4e753c4d039/
your cl.exe is of a different version from your target config. Check your C:\Program Files\Microsoft Visual Studio 9.0\VC\bin directory, and make sure you are running the correct cl.exe (32 bit or 64bit). If you are seeing this problem with Visual Studio 2008 on vista, it's not your fault. Somehow VS2008 thinks your system is 64bit and doesn't install the 32 bit cl.exe at all. In those cases, you could just try to fix this by copying Microsoft Visual Studio 9.0\VC\bin from another host.[SM]
22 How do I set command line parameter when debugging my programs in visual studio? Project->Properties->Debugging->Command Arguments [A] 23 How do I set environment variables in visual studio? Project->Properties->Debugging->Environment, add Name=Value lines into the box, for example PATH=C:\aaa;%PATH 24 There are no conversions to array types, although there are conversions to references or pointers to arrays If you do "char *a[] = new char*[10]", you see this error message, don't be fooled by *'s or pointers, this is a plain array issue: you can't assign arrays. For example, you'll get the same error if you do the following int a[] = new int[10] You'll need to use a loop to assign the elements one by one. 25 Why do I need STL? STL is Standard Template Library. It was originally proposed by SGI, and then adopted as part of the standard C++ library, although there are things that are in CGI STL but not c++ standard STL and vice versa. STL library contains a set of containers and algorithm. STL is very generic and therefore heavily parameterized. Almost every class in STL is a template.CGI http://www.sgi.com/tech/stl/stl_introduction.html CGI STL contains containers vector, list, deque, set, multiset, map, multimap, hash_set, hash_multiset, hash_map, and hash_multimap, as well as a bunch of other containers, iterators and algorithms. For a full list of objects in CGI STL, see http://www.sgi.com/tech/stl/table_of_contents.html. C++ standard STL has containers: vector, deque, list, map, set, stack, queue, bitset and algorithm, functional, iterator Aside from being general purpose and having commonly used algorithms wrapped in, STL also takes memory management off your hands. For example, std::vector is smilar to int[], however when using std::vector, you don't have to worry anything about memory management, the STL template handles that. Comments References[A] http://www.geekpedia.com/KB30_How-can-I-pass-command-line-arguments-while-debugging-within-Visual-Studio-.NET.html[CG] http://www.codeguru.com/forum/printthread.php?t=374984[CPR] http://www.cprogramming.com/tutorial/initialization-lists-c++.html[DEVX] http://www.devx.com/tips/Tip/12527[EX] http://www.exforsys.com/tutorials/c-plus-plus/c-pure-virtual-function-and-base-class.html[IF] http://www.informit.com/guides/content.aspx?g=cplusplus&seqNum=142[PC] http://pkg-config.freedesktop.org/wiki/[SM] http://social.msdn.microsoft.com/forums/en-US/vcplus2008prerelease/thread/a6eb88c0-5b17-4811-ba08-c4e753c4d039/
Project->Properties->Debugging->Command Arguments [A]
23 How do I set environment variables in visual studio? Project->Properties->Debugging->Environment, add Name=Value lines into the box, for example PATH=C:\aaa;%PATH 24 There are no conversions to array types, although there are conversions to references or pointers to arrays If you do "char *a[] = new char*[10]", you see this error message, don't be fooled by *'s or pointers, this is a plain array issue: you can't assign arrays. For example, you'll get the same error if you do the following int a[] = new int[10] You'll need to use a loop to assign the elements one by one. 25 Why do I need STL? STL is Standard Template Library. It was originally proposed by SGI, and then adopted as part of the standard C++ library, although there are things that are in CGI STL but not c++ standard STL and vice versa. STL library contains a set of containers and algorithm. STL is very generic and therefore heavily parameterized. Almost every class in STL is a template.CGI http://www.sgi.com/tech/stl/stl_introduction.html CGI STL contains containers vector, list, deque, set, multiset, map, multimap, hash_set, hash_multiset, hash_map, and hash_multimap, as well as a bunch of other containers, iterators and algorithms. For a full list of objects in CGI STL, see http://www.sgi.com/tech/stl/table_of_contents.html. C++ standard STL has containers: vector, deque, list, map, set, stack, queue, bitset and algorithm, functional, iterator Aside from being general purpose and having commonly used algorithms wrapped in, STL also takes memory management off your hands. For example, std::vector is smilar to int[], however when using std::vector, you don't have to worry anything about memory management, the STL template handles that. Comments References[A] http://www.geekpedia.com/KB30_How-can-I-pass-command-line-arguments-while-debugging-within-Visual-Studio-.NET.html[CG] http://www.codeguru.com/forum/printthread.php?t=374984[CPR] http://www.cprogramming.com/tutorial/initialization-lists-c++.html[DEVX] http://www.devx.com/tips/Tip/12527[EX] http://www.exforsys.com/tutorials/c-plus-plus/c-pure-virtual-function-and-base-class.html[IF] http://www.informit.com/guides/content.aspx?g=cplusplus&seqNum=142[PC] http://pkg-config.freedesktop.org/wiki/[SM] http://social.msdn.microsoft.com/forums/en-US/vcplus2008prerelease/thread/a6eb88c0-5b17-4811-ba08-c4e753c4d039/
Project->Properties->Debugging->Environment, add Name=Value lines into the box, for example PATH=C:\aaa;%PATH
24 There are no conversions to array types, although there are conversions to references or pointers to arrays If you do "char *a[] = new char*[10]", you see this error message, don't be fooled by *'s or pointers, this is a plain array issue: you can't assign arrays. For example, you'll get the same error if you do the following int a[] = new int[10] You'll need to use a loop to assign the elements one by one. 25 Why do I need STL? STL is Standard Template Library. It was originally proposed by SGI, and then adopted as part of the standard C++ library, although there are things that are in CGI STL but not c++ standard STL and vice versa. STL library contains a set of containers and algorithm. STL is very generic and therefore heavily parameterized. Almost every class in STL is a template.CGI http://www.sgi.com/tech/stl/stl_introduction.html CGI STL contains containers vector, list, deque, set, multiset, map, multimap, hash_set, hash_multiset, hash_map, and hash_multimap, as well as a bunch of other containers, iterators and algorithms. For a full list of objects in CGI STL, see http://www.sgi.com/tech/stl/table_of_contents.html. C++ standard STL has containers: vector, deque, list, map, set, stack, queue, bitset and algorithm, functional, iterator Aside from being general purpose and having commonly used algorithms wrapped in, STL also takes memory management off your hands. For example, std::vector is smilar to int[], however when using std::vector, you don't have to worry anything about memory management, the STL template handles that. Comments References[A] http://www.geekpedia.com/KB30_How-can-I-pass-command-line-arguments-while-debugging-within-Visual-Studio-.NET.html[CG] http://www.codeguru.com/forum/printthread.php?t=374984[CPR] http://www.cprogramming.com/tutorial/initialization-lists-c++.html[DEVX] http://www.devx.com/tips/Tip/12527[EX] http://www.exforsys.com/tutorials/c-plus-plus/c-pure-virtual-function-and-base-class.html[IF] http://www.informit.com/guides/content.aspx?g=cplusplus&seqNum=142[PC] http://pkg-config.freedesktop.org/wiki/[SM] http://social.msdn.microsoft.com/forums/en-US/vcplus2008prerelease/thread/a6eb88c0-5b17-4811-ba08-c4e753c4d039/
If you do "char *a[] = new char*[10]", you see this error message, don't be fooled by *'s or pointers, this is a plain array issue: you can't assign arrays. For example, you'll get the same error if you do the following
int a[] = new int[10]
You'll need to use a loop to assign the elements one by one. 25 Why do I need STL? STL is Standard Template Library. It was originally proposed by SGI, and then adopted as part of the standard C++ library, although there are things that are in CGI STL but not c++ standard STL and vice versa. STL library contains a set of containers and algorithm. STL is very generic and therefore heavily parameterized. Almost every class in STL is a template.CGI http://www.sgi.com/tech/stl/stl_introduction.html CGI STL contains containers vector, list, deque, set, multiset, map, multimap, hash_set, hash_multiset, hash_map, and hash_multimap, as well as a bunch of other containers, iterators and algorithms. For a full list of objects in CGI STL, see http://www.sgi.com/tech/stl/table_of_contents.html. C++ standard STL has containers: vector, deque, list, map, set, stack, queue, bitset and algorithm, functional, iterator Aside from being general purpose and having commonly used algorithms wrapped in, STL also takes memory management off your hands. For example, std::vector is smilar to int[], however when using std::vector, you don't have to worry anything about memory management, the STL template handles that. Comments References[A] http://www.geekpedia.com/KB30_How-can-I-pass-command-line-arguments-while-debugging-within-Visual-Studio-.NET.html[CG] http://www.codeguru.com/forum/printthread.php?t=374984[CPR] http://www.cprogramming.com/tutorial/initialization-lists-c++.html[DEVX] http://www.devx.com/tips/Tip/12527[EX] http://www.exforsys.com/tutorials/c-plus-plus/c-pure-virtual-function-and-base-class.html[IF] http://www.informit.com/guides/content.aspx?g=cplusplus&seqNum=142[PC] http://pkg-config.freedesktop.org/wiki/[SM] http://social.msdn.microsoft.com/forums/en-US/vcplus2008prerelease/thread/a6eb88c0-5b17-4811-ba08-c4e753c4d039/
STL is Standard Template Library. It was originally proposed by SGI, and then adopted as part of the standard C++ library, although there are things that are in CGI STL but not c++ standard STL and vice versa. STL library contains a set of containers and algorithm. STL is very generic and therefore heavily parameterized. Almost every class in STL is a template.CGI http://www.sgi.com/tech/stl/stl_introduction.html CGI STL contains containers vector, list, deque, set, multiset, map, multimap, hash_set, hash_multiset, hash_map, and hash_multimap, as well as a bunch of other containers, iterators and algorithms. For a full list of objects in CGI STL, see http://www.sgi.com/tech/stl/table_of_contents.html. C++ standard STL has containers: vector, deque, list, map, set, stack, queue, bitset and algorithm, functional, iterator Aside from being general purpose and having commonly used algorithms wrapped in, STL also takes memory management off your hands. For example, std::vector is smilar to int[], however when using std::vector, you don't have to worry anything about memory management, the STL template handles that. Comments References[A] http://www.geekpedia.com/KB30_How-can-I-pass-command-line-arguments-while-debugging-within-Visual-Studio-.NET.html[CG] http://www.codeguru.com/forum/printthread.php?t=374984[CPR] http://www.cprogramming.com/tutorial/initialization-lists-c++.html[DEVX] http://www.devx.com/tips/Tip/12527[EX] http://www.exforsys.com/tutorials/c-plus-plus/c-pure-virtual-function-and-base-class.html[IF] http://www.informit.com/guides/content.aspx?g=cplusplus&seqNum=142[PC] http://pkg-config.freedesktop.org/wiki/[SM] http://social.msdn.microsoft.com/forums/en-US/vcplus2008prerelease/thread/a6eb88c0-5b17-4811-ba08-c4e753c4d039/
CGI STL contains containers vector, list, deque, set, multiset, map, multimap, hash_set, hash_multiset, hash_map, and hash_multimap, as well as a bunch of other containers, iterators and algorithms. For a full list of objects in CGI STL, see http://www.sgi.com/tech/stl/table_of_contents.html.
C++ standard STL has containers:
vector, deque, list, map, set, stack, queue, bitset
algorithm, functional, iterator
Aside from being general purpose and having commonly used algorithms wrapped in, STL also takes memory management off your hands. For example, std::vector is smilar to int[], however when using std::vector, you don't have to worry anything about memory management, the STL template handles that. Comments References[A] http://www.geekpedia.com/KB30_How-can-I-pass-command-line-arguments-while-debugging-within-Visual-Studio-.NET.html[CG] http://www.codeguru.com/forum/printthread.php?t=374984[CPR] http://www.cprogramming.com/tutorial/initialization-lists-c++.html[DEVX] http://www.devx.com/tips/Tip/12527[EX] http://www.exforsys.com/tutorials/c-plus-plus/c-pure-virtual-function-and-base-class.html[IF] http://www.informit.com/guides/content.aspx?g=cplusplus&seqNum=142[PC] http://pkg-config.freedesktop.org/wiki/[SM] http://social.msdn.microsoft.com/forums/en-US/vcplus2008prerelease/thread/a6eb88c0-5b17-4811-ba08-c4e753c4d039/
References[A] http://www.geekpedia.com/KB30_How-can-I-pass-command-line-arguments-while-debugging-within-Visual-Studio-.NET.html[CG] http://www.codeguru.com/forum/printthread.php?t=374984[CPR] http://www.cprogramming.com/tutorial/initialization-lists-c++.html[DEVX] http://www.devx.com/tips/Tip/12527[EX] http://www.exforsys.com/tutorials/c-plus-plus/c-pure-virtual-function-and-base-class.html[IF] http://www.informit.com/guides/content.aspx?g=cplusplus&seqNum=142[PC] http://pkg-config.freedesktop.org/wiki/[SM] http://social.msdn.microsoft.com/forums/en-US/vcplus2008prerelease/thread/a6eb88c0-5b17-4811-ba08-c4e753c4d039/