C
camelot
Hello,
I’ have a curiosity. I wrote this two files:
1) testmain.c
#include <stdio.h>
extern void myfunc();
int main(int argc, char* argv[])
{
myfunc();
}
2) myfunc.cpp
#include <string>
extern "C" void myfunc()
{
string a;
}
Then I compile:
g++ -c myfunc.cpp obtaining myfunc.o
and
gcc myfunc.o testmain.c –o testmain
obtaining a lot of Symbol referencing errors!
Question1 – it is possible, through some particular compiling
tecninques, to merge this two sources?
Question2 – when someone says that it is possible to merge c and c++
program, under which conditions this statement it is true?
Thank you,
Regards,
Camelot
I’ have a curiosity. I wrote this two files:
1) testmain.c
#include <stdio.h>
extern void myfunc();
int main(int argc, char* argv[])
{
myfunc();
}
2) myfunc.cpp
#include <string>
extern "C" void myfunc()
{
string a;
}
Then I compile:
g++ -c myfunc.cpp obtaining myfunc.o
and
gcc myfunc.o testmain.c –o testmain
obtaining a lot of Symbol referencing errors!
Question1 – it is possible, through some particular compiling
tecninques, to merge this two sources?
Question2 – when someone says that it is possible to merge c and c++
program, under which conditions this statement it is true?
Thank you,
Regards,
Camelot