Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
Showing results for 
Search instead for 
Did you mean: 

How do compile this simple c++ program with gcc/g++

Former Member
0 Kudos

I am trying to write a program in C++ which uses the RFCs. I am using UNICODE and would like to use g++ to compile my programs. Here is the simpleist program that I can come up with which I can't compile. How can I compile this program? I can compile it is a C program, but NOT as a C++ program.

#include "saprfc.h"

#include "sapitab.h"

#include "sapucx.h"

#include <stdio.h>

int main()



return 0;



Former Member
0 Kudos

Hi Maribeth,

Here is hard to finf a quick answer but you can compile your .c code like this:

as good as i remember is ...

gcc <nme>.c

Please dont forget to reward....

Gabriel P.

0 Kudos

I can already compile regular C programs. I cannot compile c++ programs.

Former Member
0 Kudos mistake

you should do it on your shell like this.

g++ name.C -o name

or check this link.

Gabriel P,

0 Kudos


You are not understanding the problem, or, perhaps, I'm not explaining it well enough. I know how to compile C++ programs. The problem is when I try to compile C++ programs using the Unicode version of the SAP RFC SDK. If you look at my source code, you will see that it has some of the Unicode functions supported by the RFC SDK. How can I compile that with the C++ compiler. If you do a cut and paste of the code I posted and try to compile it with the instructions you posted, you will see the problem. That is assuming, of course, you have the SAP RFC SDK.

0 Kudos

I figured this out. You need to use the WCHAR_is_2B define on the compile line. But that's only if use gcc/g++.