Help: error LNK2019: unresolved external symbol

I had the program in a single cpp file and have moved at the functions to seperate cpp's. Since doing that I received the following error when compiling the code. Any ideas on how to resolve that?

Generating Code...
Linking...
mkMainC.obj : error LNK2019: unresolved external symbol "void __cdecl mainEvent(enum PSH_Event,union PSH_EventIncoming *,void *)" (?mainEvent@@YAXW4PSH_Event@@PATPSH_EventIncoming@@PAX@Z) referenced in function _main
mkMainC.obj : error LNK2019: unresolved external symbol "long __cdecl listHandle(struct PSH_Connection *,enum PSH_Action,union PSH_MessageIncoming,void *)" (?listHandle@@YAJPAUPSH_Connection@@W4PSH_Action@@TPSH_MessageIncoming@@PAX@Z) referenced in function _main
QuoteHandlers.obj : error LNK2019: unresolved external symbol "void __cdecl UpdateTSFinvisionInfo(char *,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,double,double)" (?UpdateTSFinvisionInfo@@YAXPADV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@NN@Z) referenced in function "void __cdecl FinvisionRecordHandle(struct PSH_SupplyObject *,void *)" (?FinvisionRecordHandle@@YAXPAUPSH_SupplyObject@@PAX@Z)
C:\SourceSafe Projects\Market View\BBTV2\Debug\BBTV2.exe : fatal error LNK1120: 3 unresolved externals

Many Thanks,

Josh
supersuny2kAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
Infinity08Connect With a Mentor Commented:
Did you add al lfiles to one project, and then rebuild the project ?

Did you include the correct header files ?

Can you show the code ? (All files preferrably)
0
 
evilrixSenior Software Engineer (Avast)Commented:
When you moved the functions to new files did you ensure you added these files to the project so they get compiled and the resultant translation units get linked into the final binary?
0
 
Infinity08Commented:
al lfiles -> all files of course ;)
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
supersuny2kAuthor Commented:
Hi, Yes all files are under one project in VS 2005 and I have included all the header files.

Interestingly, if I remove the calls in the main() and one of the function which are listed in the error, the project complies

.
0
 
Infinity08Commented:
>> Interestingly, if I remove the calls in the main() and one of the function which are listed in the error, the project complies

That's normal ;) If you removed the unresolved symbol, the linker doesn't have to look for it ... So, it doesn't throw the error either.

Can you show all your files ?
0
 
supersuny2kAuthor Commented:
Unfortunately, I can't but I have noticed something, if I change the functions or handlers to static if resolves the issue but cause other functions to have the same error.

Regards,

Josh
0
 
Infinity08Commented:
>> Unfortunately, I can't

Why is that ?

Can you at least post the relevant parts of the code. The part of the main where the function is called, the part of the header file where the function is declared, the part of the .cpp file where the function is defined, as well as the header include at the top of the main.cpp file.
0
 
supersuny2kAuthor Commented:
Hi Infinity, I have fixed it I removed static from all the function names and it has worked....
0
 
Infinity08Commented:
We could have told you that if we would have known what code you used ;) We're not clairvoyant heh.
0
 
Infinity08Commented:
Can you still post the code I asked for to verify that the solution is good ?
0
 
evilrixSenior Software Engineer (Avast)Commented:
>> I removed static from all the function names and it has worked
Note: The use of static in this context is considered deprecated, prefer to use unnamed namespace.
http://msdn2.microsoft.com/en-us/library/yct4x9k5.aspx
0
 
evilrixSenior Software Engineer (Avast)Commented:
The selected answer doesn't answer the question!
0
 
supersuny2kAuthor Commented:
Ooops... sorry select the wrong answer... my apologies - suppose to choose

"Did you add al lfiles to one project, and then rebuild the project ?

Did you include the correct header files ?"

as I was missing my header files in the end

Regards,
Josh
0
 
evilrixSenior Software Engineer (Avast)Commented:
Cheers KB.
0
All Courses

From novice to tech pro — start learning today.