C (234/257)

From:
Date:26 Feb 2001 at 00:08:25
Subject:Link together C and C++

Hi!

I got troubles when mixing C++ and C source,
for example:

/*--------------------------*/
/*--------- test.h ---------*/
/*--------------------------*/
#ifndef TEST_H
#define TEST_H

void myFunc(void);

#endif

/*--------------------------*/
/*-------- test.cpp --------*/
/*--------------------------*/
#include <stdio.h>
#include "test.h"

void myFunc(void)
{
printf("Just a test.\n");
}

/*--------------------------*/
/*-------- testmain.c ------*/
/*--------------------------*/
#include "test.h"

void main (void)
{
myFunc();
}

When I link objects, SAS doesn't find define symbol for _myFunc.
What is going? When I rename "test.cpp" to "test.c" , compile
and link, all is OK!

I need classes in myFunc, and I can't use C++ in main()!

Any solution?

wbw,
Vassili

------------------------ Yahoo! Groups Sponsor ---------------------~-~>
eGroups is now Yahoo! Groups
Click here for more details
http://us.click.yahoo.com/kWP7PD/pYNCAA/4ihDAA/d8AVlB/TM
---------------------------------------------------------------------_->

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/