Reputation: 15
My VS2010 project has 2 Static Libraries in C. I want to add another one, but in C++. My main project is already in C, so my objective is to change it the minimum possible. Is it possible to add another static library in C++? How? I already link the projects and only include the header in "main.cpp". But I get this error:
"1>c:\program files (x86)\microsoft visual studio
10.0\vc\include\cmath(19): error C2061: syntax error : identifier 'acosf' 1>c:\program files (x86)\microsoft visual studio
10.0\vc\include\cmath(19): error C2059: syntax error : ';' 1>c:\program files (x86)\microsoft visual studio
10.0\vc\include\cmath(19): error C2061: syntax error : identifier 'asinf' 1>c:\program files (x86)\microsoft visual studio
10.0\vc\include\cmath(19): error C2059: syntax error : ';' 1>c:\program files (x86)\microsoft visual studio
10.0\vc\include\cmath(20): error C2061: syntax error : identifier 'atanf' 1>c:\program files (x86)\microsoft visual studio
10.0\vc\include\cmath(20): error C2059: syntax error : ';' 1>c:\program files (x86)\microsoft visual studio
10.0\vc\include\cmath(20): error C2061: syntax error : identifier 'atan2f' 1>c:\program files (x86)\microsoft visual studio
10.0\vc\include\cmath(20): error C2059: syntax error : ';'
The solutions that I already see, tell me to compile the main project in C++, which I can't do.
Upvotes: 0
Views: 134
Reputation: 481
If you can't compile the MainProject in C++ you could write a wrapper for your C++ Library to handle the functionality you need.
Basically build another library which links in the C++ library. It shall provide the functions as extern "C"
and you can call them from your C application.
Check this link for more Information: http://www.teddy.ch/c++_library_in_c/
Upvotes: 1