1
I'll take that as a no...
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.
mt.exe : general error c101008a: Failed to save the updated manifest to the file ".\Debug\SMFLTest.exe.embed.manifest". The parameter is incorrect.
sfml-window-s.lib
sfml-graphics-s.lib
sfml-system-s.lib
sfml-audio-s.lib
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)?
// ...
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;
}
// ...
Unhandled exception at 0x102565af in SMFLTest.exe: 0xC0000005: Access violation reading location 0xcccccccc.
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!
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.
Unhandled exception at 0x102565af in SMFLTest.exe: 0xC0000005: Access violation reading location 0xcccccccc.
- 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.
#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;
}
Failed to load image "grass.bmp". Reason : Unable to open file
Unable to load bitmap.