i am new to MAC OSX, actually i installed a gcc compiler (4.2.0) in it and it gets installed in /usr/bin/gcc (default location)
Using this gcc i can compile and run anything, everything is fine with this.
Now again i installed new gcc(4.9.0) locally in /root/.../My_gcc and changed the PATH varialble to /root/../My_gcc:$PATH
and when i give gcc -- version, new gcc 4.9.0 is displayed in terminal, Now using this new gcc...
User Profile
Collapse
-
ld: entry point (start) undefined
-
Static functions are not thread safe in C++
Hi,
In have finished a project in C++, in that i have written a class Utils.cpp as given below
After everything is done, while testing the project, i am getting some wired results while accessing this class functions. Later...Code:class Utils { public: static int stringToInt(std::string); static float stringToFloat(std::string); //Many more Generalized functions like this } -
The compile options i am using,
%VCLIB% /c /W0 /Ox /EHsc /GR /D "NDEBUG" /D "_WIN32_" /MD /I%PT_INC% /I%CPP_INC% %SRC%\*.cpp -
Windows library Size
I am using
In my c++ project, and these 2 header files are included in almost 200 .cpp files and when i build a static library for the whole project in linux its size is around 10MB and when i did the same thing in windows its size is almost over 80MB, and one thing i noticed was both vector and map combinely takes 500KB in each .cpp file in windows. I am building the...Code:#include <vector> #include <map>
-
@weeknessforcat s Thanks for your reply, can you give me a link to understand the unicode much better in C++.Leave a comment:
-
Actually my string contains only 5 characters which is of square shape (unicode character), the bytes.com viewer shows like 10 characters as '?'. Don't get confused by it.Leave a comment:
-
Unicode Characters Size
Code:std::string str =""; std::cout<<str.length()<<std::endl;
this code returns 20, hence each unicode character is considered as 4 bytes, but the same code in java returns 10, where each unicode character is considered as 2 bytes.
My Question why java and c++ treats different size for the same kind of character, also if it is because of their own implementation, then... -
use gdb and get the back trace of the point where it is getting crashed actually, from that u can analyze the cause for your crash.
To use gdb in linux
=============== ====
gdb ./Sample.bin, it will start gdb
press 'r' to run the application inside gdb
once the application gets crashed, give 'bt' in the terminal
it will show the entire backtrace of the crashLeave a comment:
-
Template Return Type
Code:class xxx { public: template<class T> T void func(int a) { /* Here depending upon some-cases, i ll return * either int, float, std::string, etc... * How to do it, i am getting undefined refernce * to func */ } }; -
@weaknessforcat s, Thanks for ur reply, As u said i have implemented a similar functionality like what(), and it is working fine.:), But u said something about Visitor, what is that, it is a concept in c++?Leave a comment:
-
Banfa, Thanks for ur reply, but in my application i have more than 50 Exception classes, and more than 100 files i am using those exceptions, so i cant catch each exception for every case in all files, i can catch the base exception up-to some hierarchy and can do some operation based on the catched exception. For Eg, There are some cases,
ExceptionHirear chy
=============== ===
HeadExcep...Leave a comment:
-
Catching base class Exception as Reference.
...Code:class BaseExcep { protected: std::string message; public: BaseExcep(std::string); virtual void printException(); }; class DerivedExcep1 : public BaseExcep { public: DerivedExcep1(std::string); }; class DerivedExcep2 : public DerivedExcep1 { public: DerivedExcep2(std::string); }; -
...Code:#include <stdio.h> #include <time.h> #include <sys/time.h> void getTime() { FILE* fp = fopen("Time.txt","w+"); struct timeval usec_time; time_t now = time(0); gettimeofday(&usec_time,NULL); // format time struct tm *current = localtime(&now); printf("%d:%d:%d\n",current->tm_hour,Leave a comment:
-
Generally while writing C programs people used to do that, the reason for it in some compilers like Turbo C, the output of the previous program is still there on the output stream to clear those they will use clrscr().For y they using it after after variable declaration, in some OS u have to declare the variables at the beginning of the scope, otherwise it will give some warnings, that's they normally use it after declaring all the possible variables,...Leave a comment:
-
Release Mode , Maximum optimization O2, No CLR Support, No Unicode , and It is C++ code.
Flags used while compiling /c /W0 /O2 /GX /GR /DVER_7 /D "NDEBUG" /D "_WIN32_"Leave a comment:
-
Object file size increases in windows! why?
My sample.h is
My Sample.cpp isCode:#include <string> namespace xxx { class abc { std::string m_name; public: void initialize(); }; };
...Code:#include <sample.h> using namespace xxx; void abc::initialize() { m_name = "Siva"; -
Warning in GCC Compiler
I am getting a warning, when i compile the source code in HP_UX platform(GCC Compiler), Can anyone explain why this warning occurs and some solutions to remove it.
/var/tmp//ccUss4qx.s: Assembler messages:
/var/tmp//ccUss4qx.s:1245 8: Warning: Use of 'mov' may violate WAW dependency 'GR%, % in 1 - 127' (impliedf), specific resource number is 33
/var/tmp//ccUss4qx.s:1245 6: Warning: This is the location of the conflicting... -
Can u explain what is meant by convolution, and give some sample input and output to make it clear.Leave a comment:
-
what is the real meaning of NULL?
Here Integer pointer is assigned to NULL, I dont knowCode:int main() { int* a= NULL; return 0; }
the complete meaning of NULL till now. I am assuming tat a particular memory location is named as "NULL" and the pointer's which are assigned to NULL, points to tat particular location. Can anyone clear this basic doubt for me. -
Is it necessary the function main() should return int?
If so what is the reason, and the returning int value indicates wat?
No activity results to display
Show More
Leave a comment: