VC++ .net Build problem

Please support our C++ advertiser: Intel Parallel Studio Home
Thread Solved

Join Date: Mar 2006
Posts: 5
Reputation: RogerThomasTan is an unknown quantity at this point 
Solved Threads: 0
RogerThomasTan RogerThomasTan is offline Offline
Newbie Poster

VC++ .net Build problem

 
0
  #1
Mar 25th, 2006
I'm a new user to Visual Studio .Net, writing most of my projects in C++. I have this problem with the OO paradigm when I tried to apply it to my projects. Variables for classes which I described in eg. dXmanager.h fails to appear in my dXmanager.cpp; when I try to compiled them it just say that variable ABC is not found in dXmanager.cpp even though I have declared it in the classes in dXmanager.h. I ended up having to declare them again in dXmanager.cpp.

Secondly after I have built all the files which I needed, compiling them individually is fine with no errors. But when I tried building the whole solution there seem to be problems linking functions in my classes (in dXmanager.cpp) to the main windows program (in winmain.cpp). I kept getting the error LNK 2019 unresolved external symbol "<classname>::<functionname>" referenced in <file_name|function_name>. Is there something which I am missing here? Something which I must do to enable linking between the classes files with their header files and these classes files with the main program file?

Thanks for helping.
Reply With Quote Quick reply to this message  
Join Date: Jun 2005
Posts: 1,496
Reputation: WolfPack has a spectacular aura about WolfPack has a spectacular aura about WolfPack has a spectacular aura about 
Solved Threads: 104
Moderator
WolfPack's Avatar
WolfPack WolfPack is offline Offline
Mentally Challenged Mod.

Re: VC++ .net Build problem

 
0
  #2
Mar 25th, 2006
Originally Posted by RogerThomasTan
I'm a new user to Visual Studio .Net, writing most of my projects in C++. I have this problem with the OO paradigm when I tried to apply it to my projects. Variables for classes which I described in eg. dXmanager.h fails to appear in my dXmanager.cpp; when I try to compiled them it just say that variable ABC is not found in dXmanager.cpp even though I have declared it in the classes in dXmanager.h. I ended up having to declare them again in dXmanager.cpp.
Have you included the header file in the source file? like
  1. #include "dxmanager.h

Originally Posted by RogerThomasTan
Secondly after I have built all the files which I needed, compiling them individually is fine with no errors. But when I tried building the whole solution there seem to be problems linking functions in my classes (in dXmanager.cpp) to the main windows program (in winmain.cpp). I kept getting the error LNK 2019 unresolved external symbol "<classname>::<functionname>" referenced in <file_name|function_name>. Is there something which I am missing here? Something which I must do to enable linking between the classes files with their header files and these classes files with the main program file?
Looks like you haven't added the necessary files to your project file. Can you see your files in the Solution Explorer Window of .NET?
Reply With Quote Quick reply to this message  
Join Date: Mar 2006
Posts: 5
Reputation: RogerThomasTan is an unknown quantity at this point 
Solved Threads: 0
RogerThomasTan RogerThomasTan is offline Offline
Newbie Poster

Re: VC++ .net Build problem

 
0
  #3
Mar 25th, 2006
Yes I have included the #include "dsmanager.h" at the beginning of both the dsmanager.cpp and the winmain.cpp. Also yes I can see all 3 files (dsmanager.h, dsmanager.cpp and winmain.cpp) in my Solution Explorer Window of .NET.
Reply With Quote Quick reply to this message  
Join Date: Jun 2005
Posts: 1,496
Reputation: WolfPack has a spectacular aura about WolfPack has a spectacular aura about WolfPack has a spectacular aura about 
Solved Threads: 104
Moderator
WolfPack's Avatar
WolfPack WolfPack is offline Offline
Mentally Challenged Mod.

Re: VC++ .net Build problem

 
0
  #4
Mar 25th, 2006
Zip your code without the debug and release folders and attach here. That will help in figuring things out.
Reply With Quote Quick reply to this message  
Join Date: Mar 2006
Posts: 5
Reputation: RogerThomasTan is an unknown quantity at this point 
Solved Threads: 0
RogerThomasTan RogerThomasTan is offline Offline
Newbie Poster

Re: VC++ .net Build problem

 
0
  #5
Mar 25th, 2006
Please find zip file attached. Thanks a lot for your help btw, anyhow it is a directx application but I doubt that should be the problem, more like how visual studio .net is handling the linkage since all files compile fine indivdually. Once again thanks!
Attached Files
File Type: zip TestSound.zip (91.9 KB, 4 views)
Reply With Quote Quick reply to this message  
Join Date: Jun 2005
Posts: 1,496
Reputation: WolfPack has a spectacular aura about WolfPack has a spectacular aura about WolfPack has a spectacular aura about 
Solved Threads: 104
Moderator
WolfPack's Avatar
WolfPack WolfPack is offline Offline
Mentally Challenged Mod.

Re: VC++ .net Build problem

 
0
  #6
Mar 25th, 2006
There are two other files: dsutil.h and dsutil.cpp that are not included in the project. Dont you need them?
Reply With Quote Quick reply to this message  
Join Date: Mar 2006
Posts: 5
Reputation: RogerThomasTan is an unknown quantity at this point 
Solved Threads: 0
RogerThomasTan RogerThomasTan is offline Offline
Newbie Poster

Re: VC++ .net Build problem

 
0
  #7
Mar 25th, 2006
adding them helps reduce the number of errors from 10 to 6, the remaining 6 are still errors caused by unable to link to the functions from winmain.cpp to functions in dsmanager.h and dsmanager.cpp
Reply With Quote Quick reply to this message  
Join Date: Jun 2005
Posts: 1,496
Reputation: WolfPack has a spectacular aura about WolfPack has a spectacular aura about WolfPack has a spectacular aura about 
Solved Threads: 104
Moderator
WolfPack's Avatar
WolfPack WolfPack is offline Offline
Mentally Challenged Mod.

Re: VC++ .net Build problem

 
0
  #8
Mar 25th, 2006
Change the
  1. void shutdownDirectSound(void)
  2. {
  3. ...
  4. }
function in the dsmanager.cpp file to
  1. void dsmanager::shutdownDirectSound(void)
  2. {
  3. ...
  4. }
Similar for the other functions.
Reply With Quote Quick reply to this message  
Join Date: Mar 2006
Posts: 5
Reputation: RogerThomasTan is an unknown quantity at this point 
Solved Threads: 0
RogerThomasTan RogerThomasTan is offline Offline
Newbie Poster

Re: VC++ .net Build problem

 
0
  #9
Mar 25th, 2006
Oh man! It worked!! damnit! I would have hugged you if you are in the same room as me but since you aren't I shall thank you tremendously for taking time to not just look into my problem but help solve it! Cheers!
Reply With Quote Quick reply to this message  
Join Date: Mar 2006
Posts: 6
Reputation: unicorn11 is an unknown quantity at this point 
Solved Threads: 0
unicorn11 unicorn11 is offline Offline
Newbie Poster

Re: VC++ .net Build problem

 
0
  #10
Oct 5th, 2007
thanks a lot guys this thread solved my issue as well.
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the C++ Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC