Strange issue in gcc windows

Last week I came across a strange situation in gcc for windows. I have written some c++ codes in linux where some of the function bodies i kept in header files only.

like this

class temp

{

string m;

public:

void setm(string param){ m = param;}

string getm(){ return m;}

}

 

This is working fine when compiled and used in linux. But when I use same gcc version in windos 64 , it compiles but crashes at run time as it couldn’t locate function bodies. Will look into this farther .

imraw

 

imraw

 

 

 

 

 

 

 

 

 

This is a small utility to convert raw files to jpeg. I have been searching for some tool which can quickly transform raw file to jpeg quickly.  As a photographer i needed something like this for sending picture or sharing immediately.

Technology :  C++ ,qt,magick++

Features :

  1. drag and drop support.
  2. Options to specify specify jpeg compression, output name  and jpeg compression ratio.
  3. One click conversion to high quality jpeg.

Drawbacks :

  1.     Plenty 🙂  .  I just spent half day on this  and most of it is spent on learning and compiling imagemagick . Presently it is in pre alpha stage , you are welcome to modify it. Most things are in place , just a bit debugging is required.

Download Link :   https://github.com/rwik/imraw

Conio.h for g++

Lets admit it , most of our colleges don’t care about c++ standards while teaching c++. That is why borland c++ (or turbo c++) is still used in many college labs. But problem is , since they are not compatible with any c++ standards , people face difficulties once they are out of college. One of my colleague has a large personal c++ code base , which was entirely written in his college days using that outdated non standardised compiler. So functions like getch(),clrscr(),cprintf() etc are used widely. Now he was unable to compile any code in his linux box , and the reason was conio.h . I just googled and found that he was not alone. And there is actually a conio.h available for g++ too 🙂

 

You may visit here to have a look at it , in-case you require that

http://linux-conioh.sourceforge.net/

Language level parallelisation in c++

This is big. There is a proposal to add openmp inside c++ . If it is accepted c++ would support shared memory multiprocessing code execution model over almost all the architectures. Perhaps c++ is moving towards python path. Since python comes bundled with huge array of APIs and libraries , the phrase “batteries included” is generally attached with python. May be from c++ 14 or so , we can use that for c++ too.  Being a c++ developer am eagerly looking forward for another c++ renaissance 🙂

By the way, here are the links…

 

Self producing programs or Quines

A Quine is a computer program which prints out it’s own source code . It is named after Willard Van Orman Quine, an american mathematician and logician. The idea here is, we will be having two parts of source code like any other programs. Namely code and data. Code is the set of instructions which are going to be executed by compiler, and data part contains textual form of code inside quotation mark. Code part executes to print data part, which is nothing but code itself. To make it more clear lets see an example in c++

Language: C++
Author: lapinski@utexas.edu
#include
main(){char*s="#include%cmain(){char*s=%c%s%c;cout.form(s,10,34,s,34,10);}%c";cout.form(s,10,34,s,34,10);}</pre>
<div></div>
<pre>

This concept can be extended to multiple levels. 
They are known as ouroboros programs.
For more info visit : 
http://www.madore.org/~david/computers/quine.html

Auto redefined in c++ 11

In previous versions of c++ auto was just a storage class specifier, which can be used for declaring variables of local scope. By default all the variables were treated as auto. So the “auto” keyword was rarely used. In c++ 11 , auto makes programmers life, a bit easier. Just like PHP or any other modern language, auto now enables us to declare variables without thinking much about the type of data .  But do remember to initialize the variables while declaring.

A>     auto x = 23;  // will create an integer with value 23

B>     double f() ;

auto d = f() ; // here f is double

C>    vector<int> m;

auto it = m.end(); // here it is of type “vector<int>::iterator”