#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2004
    Posts
    9
    Rep Power
    0

    [BCB6] Access violation


    Hi everybody,

    A Borland C++ builder question...
    I've got a bloody problem with my application that I can't manage to solve. I'd appreciate A LOT any help from you guys.
    My application consists of several units with associated forms and 2 units without. In one of my units, when I include the header of a unit with a form, it's fine, but when I include the header of a unit without, I get a linker error with "Access violation, link terminated". And when I try to compile it again, I get "[Linker Error] Could not delete ProjectName.tds (project already open in IDE?)".
    How strange...

    Does anybody have any idea of what the problem could be and how I can solve that? PLEASE...
    Thanks a lot in advance.
  2. #2
  3. ASP.Net MVP
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    Aug 2003
    Location
    WI
    Posts
    4,378
    Rep Power
    1510
    the linker creates the tds file, but if it doesn't finish properly the file can get "stuck". If you delete it manually you should be able to at least try again, which may help you figure out the first problem. Need more info before I could help youwith that.
    Primary Forum: .Net Development
    Holy cow, I'm now an ASP.Net MVP!

    [Moving to ASP.Net] | [.Net Dos and Don't for VB6 Programmers]

    http://twitter.com/jcoehoorn
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2004
    Posts
    9
    Rep Power
    0
    yep, every time I need to close BCB, delete the .tds file and then re-open BCB, and open all my units again... what a pain...
    anyway, it's by doing that I discovered that compiling works fine when I include the header of a cpp with an associated form but not if there is no form...
    I'm wondering if it's a problem to include too many headers in a cpp file, 'cause there is a lot a communications between my units, thus I need to include almost all the headers in each unit, in addition to some variables (arrays, structures... called by "extern"). Is it a problem? Is there a limit?

    thanks
  6. #4
  7. ASP.Net MVP
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    Aug 2003
    Location
    WI
    Posts
    4,378
    Rep Power
    1510
    Ran into something similar doing my senior project in college. I think the problem may be in part that the same headers are being pulled into a unit multiple times. ie, you have a unit myfile.cpp which needs to include header for unit myfile2.cpp (myfile2.h) as well as it's own header, myfile.h. Items declared in myfile2.cpp may be depedent on myfile.cpp, so it's header also includes myfile.h, and you can end up having the same things declared multiple times.
    Primary Forum: .Net Development
    Holy cow, I'm now an ASP.Net MVP!

    [Moving to ASP.Net] | [.Net Dos and Don't for VB6 Programmers]

    http://twitter.com/jcoehoorn
  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2004
    Posts
    9
    Rep Power
    0
    Could be... but how can I avoid that? Put everything in a single cpp file??? sounds strange.

    But I got a new error message that I don't like at all...:
    I played a bit with the "include" order and the declaration of forms in the WinMain, and during a Make, I got an "Access violation" message, so I tried again and I then got that bcb.exe error:
    "An exception (C0000005) occured during DllEntryPoint or DllMain in module C:\Program Files\Borland\CBuilder6\Bin\ilink32.dll"

    Pretty bad, ay? Any idea?
  10. #6
  11. ASP.Net MVP
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    Aug 2003
    Location
    WI
    Posts
    4,378
    Rep Power
    1510
    One solution is to use #ifndef pre-compiler directives. There is a thread going on this right now (or was yesterday) in the c++ forum. Another is to be careful how you implement your program- it should be possible to implement it so there isn't a loop like that.
    Last edited by f'lar; April 9th, 2004 at 09:35 AM.
    Primary Forum: .Net Development
    Holy cow, I'm now an ASP.Net MVP!

    [Moving to ASP.Net] | [.Net Dos and Don't for VB6 Programmers]

    http://twitter.com/jcoehoorn
  12. #7
  13. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2004
    Posts
    9
    Rep Power
    0

    Thumbs up Problem solved!


    OK IT WORKS!!!!

    The problem was that I was declaring my global variables in the headers, resulting in multiple declarations by including the different headers in every cpp files…

    Stupid mistake… 2 weeks to understand that… Programming can be so cruel sometimes!

    Thanks anyway to everybody, this forum is great.

IMN logo majestic logo threadwatch logo seochat tools logo