Thread: VC++ settings

  1. #1
    Registered User
    Join Date
    May 2003
    Posts
    4

    VC++ settings

    I am writting a small program in VC++ 6, which has a class and a driver to test it. It compiles ok, but when I try to build it, i get 14 identical errors for each function in the class. The error is:

    date.obj : error LNK2005: "public: __thiscall Date:ate(void)" (??0Date@@QAE@XZ) already defined in driver.obj

    I have had a search on the net and this forum and this problem is supposed to be caused by using <iostream> instead of <iostream.h> etc, for the other headers. But i have not done that.

    The program builds and runs fine in dev c++ which is why I think it may be a setting in VC++ somewhere but there are a lot of them.

    Can anyone shed some light on this?

    Thanks in advance

  2. #2
    Registered User
    Join Date
    Nov 2001
    Posts
    162
    I don't know exactly what that means, but sometimes I get something like that if you include the same header file in two files you are linking. Try only including the iostream.h in a header file and including that in the source files. This may have something to do with it.

  3. #3
    Registered User
    Join Date
    May 2003
    Posts
    4
    It worked, although I don't understand why. I was taught that all the standard libaries use the #ifndef pre processor directive to prevent this sort of problem.

    Anyway, thanks for the help.

  4. #4
    Registered User
    Join Date
    Apr 2003
    Posts
    26
    Another thing that you could try is to go try is to click Settings on the Project menu. Then click the Link tab, and click Customize in the Category box. Once you are there click the force compile option check box. This should make it so that the complier ignores the duplicate defination and just creats a possibly buggy program, but at least it outputs the program.

    -JLBShecky
    System
    OS - Microsoft Windows XP Pro
    CPU - AMD Athlon XP 2600+
    Mother Board - Abit KV7
    RAM - 512 Mb DDR (333)

    C++
    Microsoft Visual Studio Pro. 6.0
    MSDN July 2001

  5. #5
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Application fails to load settings only at windows startup
    By DanFraser in forum C# Programming
    Replies: 3
    Last Post: 09-27-2009, 11:15 AM
  2. sorting the matrix question..
    By transgalactic2 in forum C Programming
    Replies: 47
    Last Post: 12-22-2008, 03:17 PM
  3. (Visual C++) MFC Tree Control to do a settings page
    By guitarist809 in forum Windows Programming
    Replies: 6
    Last Post: 08-30-2008, 11:31 PM
  4. makefile exported by vc 6.0 doesn't work
    By wow in forum Windows Programming
    Replies: 7
    Last Post: 03-24-2006, 04:20 PM
  5. Citrix regional settings
    By nvoigt in forum Tech Board
    Replies: 0
    Last Post: 10-26-2005, 07:57 AM