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

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

Former Member
0 Likes
1,342

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()

{

printfU(cU("hello\n"));

return 0;

}

5 REPLIES 5
Read only

Former Member
0 Likes
1,136

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.

Read only

0 Likes
1,136

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

Read only

Former Member
0 Likes
1,136

Sorry....my mistake

you should do it on your shell like this.

g++ name.C -o name

or check this link.

http://galton.uchicago.edu/~gosset/Compdocs/gcc.html

Gabriel P,

Read only

0 Likes
1,136

Gabriel,

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.

Read only

0 Likes
1,136

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++.