943,545 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Marked Solved
  • Views: 2592
  • C++ RSS
Mar 25th, 2006
0

VC++ .net Build problem

Expand Post »
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.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
RogerThomasTan is offline Offline
5 posts
since Mar 2006
Mar 25th, 2006
0

Re: VC++ .net Build problem

Quote 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
C++ Syntax (Toggle Plain Text)
  1. #include "dxmanager.h

Quote 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?
Moderator
Reputation Points: 572
Solved Threads: 115
Mentally Challenged Mod.
WolfPack is offline Offline
1,559 posts
since Jun 2005
Mar 25th, 2006
0

Re: VC++ .net Build problem

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.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
RogerThomasTan is offline Offline
5 posts
since Mar 2006
Mar 25th, 2006
0

Re: VC++ .net Build problem

Zip your code without the debug and release folders and attach here. That will help in figuring things out.
Moderator
Reputation Points: 572
Solved Threads: 115
Mentally Challenged Mod.
WolfPack is offline Offline
1,559 posts
since Jun 2005
Mar 25th, 2006
0

Re: VC++ .net Build problem

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, 16 views)
Reputation Points: 10
Solved Threads: 0
Newbie Poster
RogerThomasTan is offline Offline
5 posts
since Mar 2006
Mar 25th, 2006
0

Re: VC++ .net Build problem

There are two other files: dsutil.h and dsutil.cpp that are not included in the project. Dont you need them?
Moderator
Reputation Points: 572
Solved Threads: 115
Mentally Challenged Mod.
WolfPack is offline Offline
1,559 posts
since Jun 2005
Mar 25th, 2006
0

Re: VC++ .net Build problem

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
Reputation Points: 10
Solved Threads: 0
Newbie Poster
RogerThomasTan is offline Offline
5 posts
since Mar 2006
Mar 25th, 2006
0

Re: VC++ .net Build problem

Change the
C++ Syntax (Toggle Plain Text)
  1. void shutdownDirectSound(void)
  2. {
  3. ...
  4. }
function in the dsmanager.cpp file to
C++ Syntax (Toggle Plain Text)
  1. void dsmanager::shutdownDirectSound(void)
  2. {
  3. ...
  4. }
Similar for the other functions.
Moderator
Reputation Points: 572
Solved Threads: 115
Mentally Challenged Mod.
WolfPack is offline Offline
1,559 posts
since Jun 2005
Mar 25th, 2006
0

Re: VC++ .net Build problem

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!
Reputation Points: 10
Solved Threads: 0
Newbie Poster
RogerThomasTan is offline Offline
5 posts
since Mar 2006
Oct 5th, 2007
0

Re: VC++ .net Build problem

thanks a lot guys this thread solved my issue as well.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
unicorn11 is offline Offline
6 posts
since Mar 2006

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: need help with rand
Next Thread in C++ Forum Timeline: Need help with 'Dev C++' error report





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC