strange error in Eclipse - c++

hello everyone I have this snippet of the code:
void* Init(int N) {
Hand * DS = new Hand(N);
return (void*)DS;
//DS is static defined somewhere...
every time when I check in Debugger I receive the same error:
mi_cmd_var_create: unable to create variable objec
can somebody please explain why?
P.S. I know that this implementation of the function is not good, but it is what I have... Constructor of the Hand works perfectly!

This guy with the same problem solved it like:
If you have variables in your watch
window that you later eliminate from
your code then attempt to debug again
this error is generated. The fix is to
also delete the variable from the
watch list. At least this is how it
works in Eclipse Europa.

Related

Why is g_send_packet causing a crash because it's nullptr but I can't have it be anything else?

Okay, so, I'm trying to debug a DLL so that it won't crash my game when I load in but it keeps doing it for some odd reason and when I debug it, it gives me an error saying "g_send_packet was nullptr" but I can't really change what it is afaik (extremely new to this kind of stuff, only coding background is lua)
As you can see, g_send_packet is defined as an extern in globals.h, which should be fine.
extern bool* g_send_packet;
and in globals.cpp, it's defined as
bool* g_send_packet = nullptr;
But, when I inject the DLL into the game I'm running, it crashes, gives me the same line as earlier and points to this line in resolver.cpp:
if (*g_send_packet)
angle1[player->EntIndex()] = player->get_eye_angles().y;
I'm extremely confused and at this point and I'm just trying to get this to work. Any help is greatly appreciated and any extra clarification is perfectly fine with me. Thanks!

destructor not recognised by Xcode

new to this forum and to programming so please forgive any potential mistakes in my question. I am trying to code a game in c++ using SDL2 and Xcode 6.3.2. In my Game class (see below) Xcode does not recognise my destructor and gives me the error: expected member name or ';' after declaration
I have no idea what is wrong with my destructor or my code in general. My question is simply: What have I done wrong? Thanks in advance!
update:
Narrowed the issue down and ran the code in cpp.sh without any issues. Xcode still gives the error message and I am unable to build because of it. I have tried restarting my computer, deleting the derived data and cleaning the build folder but to no effect.
int main() {
class Game {
public:
Game();
~Game(); //here is the issue
};
}
update 2: Simply removed the non working code and retyped it. The error message did not reappear and the build succeeded. Xcode had probably indeed cached the error message in some strange way.
You need to have written:
Game::~Game(){
}
somewhere at the bottom, outside the class.
Then it will compile fine :)

Compiler error on Stopped enum value using GetStatus

I'm trying to get the status of a sound effect but I don't know how to actually find out what the status is. I'm quite new to C++. I tried to read up about enums and apply what I saw, but it won't work.
Here's my code
sf::Sound::Status BeepStatus = Beep.GetStatus();
cout << BeepStatus;
if (BeepStatus == Stopped)
{
Beep.SetPitch(float((rand()%15)-1)/10);
Beep.Play();
}
That code won't work. During compile it will say that Stopped is not defined. What should I do?
You need to use the scope operator for your Stopped variable.
Likely, it's this:
sf::Sound::Stopped

Microsoft Dynamics AX 2009: Error executing code: Wrong argument types in variable assignment

I have added an object member to InventMovement class and have created one parameter method for the same but following line of code is popping up above error:
movement.parmProdJournalId(this.JournalId);
JournalId parmProdJournalId(JournalId _prodJournalId = prodJournalId)
{
;
prodJournalId = _prodJournalId;
return prodJournalId;
}
After adding the object member and parameter method I have also compile forward InventMovement but no success. Will appreciate if anyone of you could help me in this regard
Rgds
PS: I am doing the same thing which is mentioned in this blog post: http://www.artofcreation.be/2009/04/04/wrong-argument-types-in-variable-assignment/
I stopped the AOS, renamed AXAPD.AOI file and restarted the AOS. This resolved the problem. I got this solution from other forum where also I posted this question.
It is kind of strange, should work.
I could not reproduce your problem, but once had a similar problem. Solved it by re-compiling and synchronizing every involved class and table (more than once).
Also make sure nobody else is using any of these objects, maybe best is to restart the AOS.
EDIT (after comment on question):
Another possibility: it seams that you are also mixing JournalId and ProdJournalId.
I think the parameter and return value of parmProdJournalId should also be ProdJournalId.
Just try this one:
ProdJournalId parmProdJournalId(ProdJournalId _prodJournalId = prodJournalId)
{
;
prodJournalId = _prodJournalId;
return prodJournalId;
}
could not try it myself since I could'nt reproduce the error
If you can't restart the AOS, delete the local cache files of the client might work, i.e. *.auc from:
C:\Documents and Settings\Local Settings\Application Data

What has to be Glib::init()'ed in order to use Glib::wrap?

So I'm trying to make use of a GtkSourceView in C++ using GtkSourceViewmm, whose documentation and level of support give me the impression that it hasn't been very carefully looked at in a long time. But I'm always an optimist :)
I'm trying to add a SourceView using some code similar to the following:
Glib::RefPtr<gtksourceview::SourceLanguageManager> source_language_manager = gtksourceview::SourceLanguageManager::create();
Glib::RefPtr<gtksourceview::SourceLanguage> source_language = Glib::wrap(gtk_source_language_manager_guess_language(source_language_manager->gobj(), file, NULL));
Glib::RefPtr<gtksourceview::SourceBuffer> source_buffer = gtksourceview::SourceBuffer::create(source_language);
gtksourceview::SourceView* = m_source_view = new gtksourceview::SourceView(source_buffer);
m_vbox.pack_start(*m_source_view);
Unfortunately, it spits out the warning
(algoviz:4992): glibmm-WARNING **:
Failed to wrap object of type
'GtkSourceLanguage'. Hint: this error
is commonly caused by failing to call
a library init() function.
and when I look at it in a debugger, indeed the second line above (the one with the Glib::wrap()) is returning NULL. I have no idea why this is, but I tried to heed the warning by adding Glib::init() to the begining of the program, but that didn't seem to help at all either.
I've tried Google'ing around, but have been unsuccessful. Does anyone know what Glib wants me to init in order to be able to make that wrap call? Or, even better, does anyone know of any working sample code that uses GtkSourceViewmm (not just regular GtkSourceView)? I haven't been able to find any actual sample code, not even on Google Code Search.
Thanks!
It turns out, perhaps not surprisingly, that what I needed to init was:
gtksourceview::init();
After this, I ran into another problem with one of the parameter to gtksourceview::SourceLanguageManager, but this was caused by a genuine bug which I subsequently reported and was promptly fixed. So everything's working great now!
I use gtkmm. Typically you have to initialize things with something like :
_GTKMain = new Gtk::Main(0, 0, false);
Of course do not forget :
delete _GTKMain;
Check here for details :
http://library.gnome.org/devel/gtkmm/2.19/classGtk_1_1Main.html
(Sorry but the link option does not work ...)