Create one program with a C and CPP modules

415 pts.
Tags:
AS/400
iseries v5r4
How can I create program with mixed modules? is it possible ? I create my modules in this way:
// int function1(parms) 
crtcmod ( LIB/MOD ) 
...
//int mehtod2( )
crtcppmod ( LIB/MOD2 )  
...
crtpgm ( LIB/CPPPGM ) MODULES ( LIB/MOD LIB/MOD2 ) 
fails with the message  "Definition not found for symbol function1___" how can I do it ? 
Thanks


Software/Hardware used:
v5r4

Answer Wiki

Thanks. We'll let you know when a new response is added.

Yeah , never mind it was a dummy question, I was trying to get a program with modules compiled in c and in cpp :

uno.h :
<pre>
extern “C” {
int sum(int a , int b) ;
}
</pre>

uno.c
<pre>
int sum ( int a , int b ) {
return a + b;
}
</pre>

dos.cpp
<pre>
#include “uno.h”
int main (int argc , char ** argv ) {
int a = 9 ;
int b = 10 ;

int result = sum( a, b ) ;
printf (“Sum %d \n”, result );
return 0 ;
}
</pre>
WIth the keyword ‘extern’ and without the ‘#ifndef’ of the h files(that I used in cpp before to transform int a C program) I could create the program successful.

Thanks Tom

Discuss This Question: 1  Reply

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • TomLiotta
    "Definition not found for symbol function1___" Where is 'function1___'? Actually, that looks like a C++ name. Because your code shows this line:
    // int function1(parms) 
    ...I'd assume that you actually are attempting to reference a proc in your C module and its real name is 'function1()'. Right? It's hard to tell because it's not clear what code you're showing. I can't tell what language it's supposed to be. Tom
    125,585 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following