Click here to Skip to main content
15,896,475 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi to everyone,

I'm creating a static lib(sample.lib) for ordinary c coding. I created the static lib using MSVC++ 2005. In the visual studio i changed the compiler as "Compile as C code (/TC)" in the project property->c/c++->Advanced->compile as option.



If i include this lib in another project(project name - sample). In the sample project, i changed the option in compile as to "Compile as C++ code".



I get linking error unresolved external symbol for all the function in the static lib file. It is also not working for the option "Default". I'm getting same error.



If the change the option to "Compile as C code". It's working fine. I want to make the static lib file as compiler independent. How to do this? Please reply for this.



Thanks in advance for the replies.
Posted

1 solution

Do you have in your plain C header declaration below?

#ifdef __cplusplus
extern "C" {
#endif

....


#ifdef __cplusplus
}
#endif
 
Share this answer
 
Comments
balasubramaniyan94 20-Sep-10 4:48am    
Thank you very much. It's working now.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900