Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Xavura

Pages: [1]
1
General / Dead?
« on: June 10, 2009, 01:48:04 pm »
I'll take that as a no...  :(

2
General / Dead?
« on: May 31, 2009, 09:02:36 pm »
Are the ruby bindings still being worked on?

3
Graphics / LoadFromFile() hates me.
« on: February 18, 2009, 07:09:51 pm »
I have defined SFML_DYNAMIC in Project Properties > Configuration > C/C++ > Preprocessor > Prepocessor Definitions.

Upon compiling I receive just one error:

Code: [Select]

mt.exe : general error c101008a: Failed to save the updated manifest to the file ".\Debug\SMFLTest.exe.embed.manifest". The parameter is incorrect.


Any ideas?

4
Graphics / LoadFromFile() hates me.
« on: February 18, 2009, 05:28:35 pm »
In Project Properties > Configuration > Linker > Input > Additional Dependencies I have:

Code: [Select]

sfml-window-s.lib
sfml-graphics-s.lib
sfml-system-s.lib
sfml-audio-s.lib


EDIT:

I've tried changing them to the -s-d.lib variants and I get a LOT of errors. Changing them to the variants without suffixes also generates errors.

5
Graphics / LoadFromFile() hates me.
« on: February 18, 2009, 05:21:16 pm »
Quote from: "Tank"
Quote from: "Xavura"
The debugger is pointing to the line with the call to LoadFromFile() (only when using an absolute path).

Maybe a dumb question, but are you escaping the \ characters (if used at all)?

:shock:

Like... double backslashes?

No. :x Please don't tell me that's the problem...

I'll try now.

EDIT:

Doesn't make a difference:

Code: [Select]

// ...

if (grassImage.LoadFromFile("C:\\Documents and Settings\\Xavura\\My Documents\\Visual Studio 2008\\Projects\\SMFLTest\\grass.bmp")) {
cout << "Worked." << endl;
}
else {
cout << "Didn't work." << endl;
}

// ...


Code: [Select]

Unhandled exception at 0x102565af in SMFLTest.exe: 0xC0000005: Access violation reading location 0xcccccccc.

6
Graphics / LoadFromFile() hates me.
« on: February 18, 2009, 05:18:45 pm »
Quote from: "Tank"
Nah, importing namespaces is not comparible with defining variables. It's something that happens at compile-time, not run-time.
If you ever want to maximize your compilation times, then yeah, you'll be fine importing in functions, where you need the imports. ;)
Basically, my opinion is to use imports as less as possible. It even makes your code clearer, because you can see where types and other things belong to. Also imagine Laurent wouldn't use CamelCase for classnames. You'd have a perfect nameclash with sf::string and std::string, for example. The only reason why people import is to write less code. But I think that's not really an advantage. C++ invented namespaces, don't throw them away, again! ;)

Thanks for the information, 'tis handy to know and I agree that writing less code isn't that much of an advantage.

Do you have anything to say regarding my problem because you seem to be knowledgeable enough.

7
Graphics / LoadFromFile() hates me.
« on: February 18, 2009, 05:12:28 pm »
Quote from: "Nexus"
No, as I said, it's good practice to keep the using namespace as local as possible or better to avoid it completely. That's similar to variable declarations: You don't declare something globally if you need it only in one function.

Your problem seems to be anywhere else. Did you use the debugger to find out where the access violation occured?

If nothing helps, recompile SFML, possibly something went wrong.

The debugger is pointing to the line with the call to LoadFromFile() (only when using an absolute path).

Recompile? I downloaded the headers/libraries like the tutorial says to. Was I supposed to do something else?

8
Graphics / LoadFromFile() hates me.
« on: February 18, 2009, 05:05:39 pm »
Using an absolute path causes something like this to happen:

Code: [Select]

Unhandled exception at 0x102565af in SMFLTest.exe: 0xC0000005: Access violation reading location 0xcccccccc.


I'll try putting them in other locations but ... as stated twice, I have already tried every possible location.

9
Graphics / LoadFromFile() hates me.
« on: February 18, 2009, 05:02:49 pm »
Quote from: "Tank"
  • Don't import a namespace inside a function definition.
  • Use double-quotes for strings, not single-quotes (:arrow: "grass.bmp").
  • Double-check paths. Use an absolute path for testing, like C:\grass.bmp, and put the file there.


I'm really new to C++ but the tutorials I have been following usually import namespaces inside functions. Is there any reason not to?

Say if function a uses std and function b doesn't, then it makes more sense to import std for function a only rather than globally for the entire file?

I did use " in the actual file, just ' when I posted on the forum.

I'll check the paths and try an absolute path but last time I tried that I got access violations/exceptions.

Thanks for the help so far.

10
Graphics / LoadFromFile() hates me.
« on: February 18, 2009, 04:57:57 pm »
No, they are actually quotation marks like > " I'm just used to using apostrophes. :lol:

... and if by project directory you mean:

C:\Documents and Settings\Xavura\My Documents\Visual Studio 2008\Projects\SMFLTest\SMFLTest\HERE

... then yes.

11
Graphics / LoadFromFile() hates me.
« on: February 18, 2009, 04:45:13 pm »
Like I said before, I have tried putting it in every possible place... I just tried putting it with the .vcproj file to no avail.

I've had Input, Event, Clock, Window and RenderWindow all working fine it's just this that refuses to work.

... the code is pretty much:

Code: [Select]

#headers go here ...

int main() {
    using namespace sf;
    using namespace std;

    Image grassBitmap;

    if (grassBitmap.LoadFromFile('grass.bmp')) {
        cout << "Loaded bitmap." << endl;
    }
    else {
        cout << "Unable to load bitmap." << endl;
    }

    cin.clear();
    cin.ignore(255, '\n');
    cin.get();

    return 0;
}


Output:

Code: [Select]

Failed to load image "grass.bmp". Reason : Unable to open file
Unable to load bitmap.

12
Graphics / LoadFromFile() hates me.
« on: February 18, 2009, 04:27:12 pm »
I am unable to load an image from file, I think it's because I'm not putting it in the right place but I've tried EVERYWHERE. I've even tried it with absolute paths to the image but that caused all kinds of errors.

I'm using Visual Studio C++ 2008 Express Edition. I've tried putting the .BMPs in "Resource Files", in the Project's directory etc. plus I've tried JPGs and PNGs as well.

The error is "Failed to load image .... Reason: Unable to open file".

I'm not sure if that means unable to OPEN or unable to LOCATE, either way I'm lost.

:?

Pages: [1]
anything