Very simple code. I'm just trying to get a integer returned to a test job. Below is the code. It compiles ok, but when I run it I get: "Error Compiling parallel transformer cpp_test_routine". While making the routine I have 2 int as input and the return value is int also...
Make sure you have the same compiler that is specified in the environment variables in the admin client. Also make sure that your path variables are set so that the compiler and all libraries are accessible.
Also - have you reviewed all the steps outlined below (make sure and set it for the correct version).
mixing namespace and C is bad. (namespace is C++, these are C headers).
use <cstdio>, <cstdlib>
<cstring> is something else, use <string.h> if you are going to use C's string routines (recommended, c++ overthunk it).
This "error" can cause some compilers to bomb with weird messages depending on the settings and more. Other compilers eat it just fine.
alternatively, you can remove the using namespace std and use the old C headers instead.
You don't need ANY of these libraries to add 2 integers. You are bloating your code ... only include what you use, even if your compiler can remove the unused stuff, it is still best to just not pull it in (faster compiles, easier to understand the code, and more reasons). Granted, you will probably need most of the ones listed once you get past your test function.
FWIW I compile with this in a shell script to use with datastage:
g++ -O -fPIC -Wno-deprecated -m64 -mtune=generic -mcmodel=small -shared -m64 -c $1
This may not be the only, or best way, but it works for me under linux on 11.X.
I still recommend the corrections I gave in case you ever change to a more picky compiler. Visual studio used to explode when C headers were put in C++, not sure if it still does.