Jump to content
  • Advertisement
Sign in to follow this  
yellowstar

Unity Linking via preprocessor problems, and static libs with classes linker errors

This topic is 3965 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm having troubles with exceptions. I'm trying to catch access violations and page faults.(My Dev-Cpp debugger won't goto wherever my game crashed for some reason.) (The Win98 error says page fault, unknown module, at pos 0.) (Mainly page faults) But, it won't work. I'm using try-catch(char*) code. Is there a special way to catch these exceptions? Click here to jump to my linking via preprocessor problem. See the post after that for the classes problem. [Edited by - yellowstar on December 11, 2007 4:29:26 PM]

Share this post


Link to post
Share on other sites
Advertisement
You should look at Structured Exception Handling (SEH), that is the right way to handle those exceptions, you do not want to handle those exceptions using C++ exceptions since those were not meant to handle those type of issues.

Google Structured Exception Handling for more information

Share this post


Link to post
Share on other sites
Perhaps you should use an IDE with an excellent debugger, such as the free Microsoft Visual C++ Express Edition 2008, recently released. Dev-Cpp hasn't been updated in a long time.

Share this post


Link to post
Share on other sites
What I really want to know is where my game is crashing.

Is there a way to find
where the program crashed/threw the exception,
from the exception data in the catch statement?

My game uses DLLs.
This could be why my debugger isn't working right.
(I had problems with it not telling me where
it crashed before.)

My primary dev PC is Win98.
I also have a XP.

I can use VS on my XP.
But,
It wouldn't work with the VS version on my 98.
I could use VS on my XP for debugging only,
for this project.

I'm trying to throw my own exception.
But,
it won't work.
I just get abnormal program termination errors.

My code is something like this:

try
{
throw("Hello...");
}

catch(char *ex)
{
...
}


Share this post


Link to post
Share on other sites
This game is going to be cross-platform.
(PC, Console, Handheld)
(PC = Windows, Linux, ect.)
(Console = Wii, NGC)
(Handheld = Nintendo DS)

Could somebody point me to
some tutorials/documents about
using SEH with Dev-Cpp/GNU?
(Using it with C/Cpp, without using OS things.)

Share this post


Link to post
Share on other sites
Quote:
Original post by yellowstar
This game is going to be cross-platform.
(PC, Console, Handheld)
(PC = Windows, Linux, ect.)
(Console = Wii, NGC)
(Handheld = Nintendo DS)

Could somebody point me to
some tutorials/documents about
using SEH with Dev-Cpp/GNU?
(Using it with C/Cpp, without using OS things.)


SEH is a Windows only thing, AFAIK. Access violations have nothing to do exceptions in C++. What you are looking for is a debugger. If Dev-Cpp's debugger cannot meet your needs, you should investigate alternatives.

Share this post


Link to post
Share on other sites
Would static librarys compiled with GNU
work with VS Cpp?

I don't have the Windows SDK.(Dial-Up)
(I could use DL manager, but that would probably
take several nights.)
(If the above is true, would using the Dev-Cpp version of the SDK
in VS Cpp work?)
All,(or most)
Win32 things is in a static library.(I might need to move it
to DLL to get it to work.)

I don't have the OpenGL SDK either.
(I have the Dev-Cpp version)

How would I integerate oGL with VS Cpp?

VS would only be used for debugging.
The Dev-Cpp version would be the one
used for playing and ect.

EDIT:
Exception handling wouldn't be much use here anyway.
I already know the address it crashes at.

Share this post


Link to post
Share on other sites
Well, without a fast internet connection it will take you quite a while to download something like VC2008, let alone VC builds of any other libraries you are using.

Are you sure you have debugging symbols enabled in the Dev-Cpp project settings? (project->project options->compiler->linker->generate debugging information). Do a full rebuild and see if running in the debugger shows you where your program is dying.

If not, you could always give gdb command line program a try. Its complex, but for a simple program it will probably find your access violation.

First, you need to add your dev-cpp binary path 'C:\path\to\Dev-Cpp\bin' to you PATH environment variable, if it isn't already. Open a console (Windows key + R, type cmd and return).

PATH = "C:\path\to\dev-cpp\bin";%PATH%


Then navigate to your program (newly built with debug symbols, see above).

cd C:\my\programming\projectsgdb


Type the name of your program:

(gdb) file myprogram.exe
(gdb) run


At this point, my application crashes. Gdb prints the following output:

Starting program: C:\...\C_Helper.exe

Program received signal SIGSEGV, Segmentation fault.
0x004012f2 in foo (a=0x22ff74) at main.c:9
9 *ptr = 42;



To get a backtrace, type bt full:

(gdb) bt full
#0 0x004012f2 in foo (a=0x22ff74) at main.c:9
ptr = (int *) 0x0
#1 0x0040136e in main () at main.c:24
ptr = (int *) 0x0
(gdb)


I've never tried any complicated debugging with the gdb command line program, but this much is enough to give a good hint at where your access violation is occurring.

As you can see its a long procedure. It could be worth your while setting that download manager.


Share this post


Link to post
Share on other sites
I have VS Cpp and C-Sharp on my XP.
It only took one night to download
for each program.
(I'm starting to download the the 08 versions
of the above, plus the web designer.)
(But, I can only do one app per night)
(My DL manager won't work when I
attempt to have it download multiple
things in one session. I'll have to find another one for that.)

I have found out from the VS Cpp Web installer,
that it also downloads the librarys and headers
for the Windows SDK.
That elimates downloading that.
That leaves only oGL to solve.

How do I add headers and librarys,
to the default directory for them?(Like where the WinSDK things are put.)
(In VS 08)

Dev-Cpp makes sure the debugging setting is set.
If it's not set, it forces me to
rebuild it with debugging info.

I tried this code for throwing my own exceptions,
but it still does the same thing.

try
{
throw new char*("EXCEPTION!!! CRASHINGG!! HELP!!!");
}

catch(char *e)
{
MessageBox(NULL,e,"EXCEPTION",MB_OK|MB_ICONINFORMATION);
}


Share this post


Link to post
Share on other sites
Gdb worked!(Only once...)
Dev-Cpp still dosen't find it,

According to gdb,
it's crashing at a string function.(msvcrt.dll)

Dev-Cpp says in the backtrace,
that the last called function is Reshape.
I'll need to investigate.
<edit>
It is diffently crashing in the above function.
Time to find out why...
</edit>

I'm having big problems with the VS Cpp 08 install.

It crashes near the middle of the
NET 3.5 framework install.

I tried removing all MS VS and NET
stuff, but that didn't fix it.

I'm going to see if
installing that seperately does anything.
(That will probably mean another overnight download.)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!