I'll try to be simple and quick
I'm developing a program, a windows form actually.
I have a pictureBox and in the following line, when I run in debug mode(note that), I get an System.IO.FileNotFoundException exception:
pictureBox1->Image = Image::FromFile(".\\images\\no-avatar2.jpg");
The problem is that I don't get that exception when I run the exe file AND the file loads perfectly.
Any ideas why this happens?
I use this:
pictureBox1->Image = Image::FromFile(System::IO::Path::GetDirectoryName(System::Reflection::Assembly::GetEntryAssembly()->Location) + "\\images\\no-avatar2.jpg");
and it works perfectly
Related
Things that i should note are that I am using the latest version of vs code to write in c, my compiler is mingw-w64. Whenever I run a simple code (Hello world for example) everything works then suddendly when I try to do something else a message appears saying (program name).exe was not found. This generally happens when I try to use commands from other libraries, i tries using conio.h textcolor() but it doesn't want to, but when i use getch() it works fine. Moreover the .exe file exists, then i add a single line of code and boom suddendly it doesn't exist. Can anyone explain to me what is going on??
If I create a new C11 application in Netbeans (with auto-generated makefile), add a dummy function to its main.c file that just returns 0, add a test to the function, and run the test via Netbeans from the test folder, I get the following error:
make: *** [nbproject/Makefile-impl.mk:73: .test-impl] Broken pipe
However, when I debug the test, it works properly. I get varying results when testing the whole project-- sometimes the output ends with the following message:
CUnit - A unit testing framework for C - Version 2.1-3
http://cunit.sourceforge.net/
And sometimes I get the same error. Regardless the actual test results don't get output. Although if I close Netbeans and reopen, the first time I try to test the project the results are displayed correctly, although not any of the subsequent tries.
Any idea what this could be?
This is using CUnit 2.1.3-1, make 4.2.1-2, and gdb 7.12.1-2, all in cygwin 2.10.0 running on Windows 10.
Here's lines 71-73 of the makefile it's referring to, if that helps:
.test-impl: .build-tests-impl .test-pre
##echo "=> Running $#... Configuration=$(CONF)"
"${MAKE}" -f nbproject/Makefile-${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .test-conf
Of course I can provide more of that file if needed, although you should get the same one if you reproduce the steps that led me to the error.
I have successfully installed MonoDevelop with the F# bindings (under Linux Arch).
If I try a simple HelloWorld with winforms, I get this strange behavior: the program compiles and builds successfully, but a moment after the window is loaded it just closes itself and the program returns with no error messages.
I checked the logs and it seems no error is thrown (except from the one discussed here: GLib-CRITICAL **: Source ID XXX was not found when attempting to remove it, which anyway seems unrelated).
The code for the program:
open System.Drawing
open System.Windows.Forms
[<EntryPoint>]
let main argv =
let form = new Form(TopMost = true, Text = "Hello World")
form.Show()
0 // return an integer exit code
If I try to run it through the interactive console, the window is sort of freezed: I can move it around, but I can't close it (have to shut down monodevelop in order to do so).
I also tried to compile it via terminal, using:
fsharpc Program.fs -pkg:dotnet.dll
mono Program.exe
but it behaves the same way as if I was running through MonoDevelop (window opens then shuts down).
Other than that F# seems to work fine, I can run console programs without any problem.
I also tried to run a simple HelloWorld program with C# in MonoDevelop, and it just works fine.
Any tips?
You need to start the forms event loop with something like
Application.Run(new Form())
i'm trying to load bitmap like this:
BITMAP *image = load_bitmap("picture.bmp", NULL);
when I test it:
if (image == NULL)
printf("No image loaded\n");
it prints No image loaded so load_bitmap doesn't work ... i have also tried absolute path but still nothing.
Im using Ubuntu and allegro 4.2
Some suggestions?
Did you try placing the image on the same location as the executable? After that is solved check this things also if still getting the error:
Is really a *.bmp file? A file of a different type can not be converted by just renaming it.
Is the file you are trying to read actually called like that? Check for spelling both in code and in the file explorer.
Does the program run correctly if executed from the file explorer or command-line but not from the IDE? If that is the case, then you should change the configuration of the workspace or project you are currently using so that the execution directory is the same as the one where the image file is located.
If all else fails then try following the steps of the tutorial again, perhaps you made something wrong. By the way, if this is your first C++ project I recommend you that instead go to more basic stuff and stick to the command-line for a while until you get the hang of the facilities the language and its libraries have to offer.
i'm trying to do some code in a keyboard driver, a 3rd party software that looks like this can run the command i'm trying to do in a plugin file that compiles alongside the daemon that the command needs to be sent to. the command looks like this.
g15_send_cmd (g15screen_fd,G15DAEMON_MKEYLEDS,mled_state);
here's the code i'm working with and trying to run the command in (it compiles as a plugin with the daemon. in the uncompiled source it's
"g15daemon/plugin/g15_plugin_uinput.c"
the file that defines the command is in
(link)
"g15daemon/libg15daemon_client/g15daemon_clinet.h"
whereas with the g15macro (3rd software) is run from outside the daemon for various reasons i don't want to (and pretty much can't) use it, one being speed of execution of commands when keys are pressed.
so the program compiles like this without error it seems. but if the code i specified above activates, the driver(daemon) crashes giving
g15daemon: symbol lookup error:
/usr/lib/g15daemon/1.9.5.3/plugins/g15plugin_uinput.so: undefined
symbol: g15_send_cmd
what did i do wrong or what am i missing here? (and i'm sorry if the code in the plugin file is ugly down by that switch command, but i didn't know how to do any better since i don't know C much at all, all i have behind me are Py and C#)
Edit: the solution was given
but i don't know how to add a linker flag, also since it links to a part of the program being compiled will it even work?
You forgot to link your plugin with g15daemon_client library. The simple way to fix it is to add -lg15daemon_client to the linker flags.