Can't compile a VS C++ project using the exact same files and settings as a VS C project - ( linker errors ) ??

Greetings,

I have a Sybase project coded in 'C' but I need to compile it in C++.  After various attempts using different workspaces (i.e. Win32 App/Win Console) and different source files (C/C++) I always end up with the same linker errors.  The original C project is a Console application but I need a Win32 app done in C++.  The Win32 app will compile as long as I stipulate the source files to be in 'C'.  Thus, I've concluded the sole problem is due to making the project a C++ application.  Here are my errors:

error LNK2001: unresolved external symbol "long __stdcall ex_ctx_cleanup(struct _cscontext *,long)" (?ex_ctx_cleanup@@YGJPAU_cscontext@@J@Z)
error LNK2001: unresolved external symbol "long __stdcall ex_con_cleanup(struct _csconnection *,long)" (?ex_con_cleanup@@YGJPAU_csconnection@@J@Z)
error LNK2001: unresolved external symbol "long __stdcall ex_connect(struct _cscontext *,struct _csconnection * *,char *,char *,char *,char *)" (?ex_connect@@YGJPAU_cscontext@@PAPAU_csconnection@@PAD222@Z)
error LNK2001: unresolved external symbol "void __stdcall ex_panic(char *)" (?ex_panic@@YGXPAD@Z)
error LNK2001: unresolved external symbol "long __stdcall ex_init(struct _cscontext * *)" (?ex_init@@YGJPAPAU_cscontext@@@Z)
error LNK2001: unresolved external symbol "long __stdcall ex_fetch_data(struct _cscommand *)" (?ex_fetch_data@@YGJPAU_cscommand@@@Z)
error LNK2001: unresolved external symbol "void __stdcall ex_error(char *)" (?ex_error@@YGXPAD@Z)
error LNK2001: unresolved external symbol "long __cdecl ex_use_db(struct _csconnection *,char *)" (?ex_use_db@@YAJPAU_csconnection@@PAD@Z)
fatal error LNK1120: 8 unresolved externals

I tried not using 'precompiled' header files but it didn't make a difference.  Bottom line, I want to use the Sybase code for database connectivity and the C++ code for more powerful operations than I would otherwise have in C.  How can I get this compiled ????
John500Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

jkrCommented:
Put a

#ifdef __cplusplus
extern "C" {
#endif

// include Sybase headers here...

#ifdef __cplusplus
}
#endif

construct around your inclusion of the Sybase header files. Otherwise, the compiler will assume C++ and decorate the symbol names the C++ way.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
John500Author Commented:
jkr,

Wow, that did the trick!  Thanks.

My current task has various pieces to it and this question handles activity which occurs after the 'directory watcher' discovers a change in the specified directory.

My tasks are this:

1)  The service    // done
2)  The GUI to display the directory  // not done
3)  Database transaction based on directory contents // compiled

I had every intention of getting back to you on the other question because I still have to finish it.  I just couldn't seem to get that off the ground.  Now that this is compiled, I'll finish the other.  Thanks.






0
jkrCommented:
You're welcome :o)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C++

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.