im pretty new in C-programming. I use CLion from JetBrains to program my stuff. I would like to know how to add multiple c files in the makelist.
i would like to just open a program and to execute it..if its possible
my ide works just for one file. so i always have to change the name of the c. file in the makelist
i have already tried a lot of combinations of the makelists file but nothing worked.
does somebody have an idea how to fix this problem?
I have edit two new pictures
In this example I have two c files which i would like to execute.
My goal is to add the whole c file tree on the left side to the CMakeList
Here are the pictures
!enter image description here
Here is the error log
enter image description here
Here is the solution. Thanks to your response someprogramerdude
I just added executables and i changed the project in the beginning. the reason why i use picture is that you can see the source files on the left side
enter image description here
Related
I wonder what I'm doing wrong?
I want to add a file to the mpd playlist with C.
The connection works and I can play a file, which I manually put in Gnome Music Player Client for example with:
mpd_send_play(conn);
but adding the file within a C code results in an error.
Thanks for any help?
const char *path = "/home/user/foo.mp3";
mpd_send_add(conn,path);
It's really hard for us to help you if you provide this little information. I'm assuming you're using libmpdclient to try to write an MPD client.
What error are you getting?
Did you #include <mpd/client.h> or are you picking and choosing header files that that one includes for you? mpd_send_add() is a function from mpd/queue.h, are you including that header?
Could you show more code or detail your build steps so we can try to recreate your error?
I have a small C console program and I want to add an .ico file to it, so that the executable looks nice.
How can I do this in CodeBlocks with MinGW/gcc?
I could not find relevant help via google that a total beginner (like me for C) could follow, so I will Q&A this topic.
First of all you need an .ico file. Put it in the folder with your main.c file.
In CodeBlocks go to File -> New -> Empty File and name it icon.rc. It has to be visible in the Workspace/Project otherwise CodeBlocks will not be aware of this file. It will show up there in a project folder called Resources .
Put the following line in it: MAINICON ICON "filename.ico". MAINICON is just an identifier, you can choose something different. More info 1 & More info 2.
Save the files and compile - CodeBlocks will do everything else for you
What will happen now, is windres.exe (the Resource Compiler) compiling the resource script icon.rc and the icon to an object binary file to obj\Release\icon.res. And the linker will add it to the executable.
It's so easy yet it took me quite a while to find it out - I hope I can save someone else having the same problem some time.
I'm using Xcode to write C code. Firstly, it took me for ages to figure out that I need to go to Product->Edit Scheme->Select Executable in order to run C executables.
I have a lot of source files and each one has a main so is there any way to run C source files by just selecting them from left-hand pane and pressing Run? Is there a simpler workflow?
Add new target and select the source file which you need and assign to this target and run.
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 am programming with C using Code::Blocks. My project is divided in 3, header, implementation and main.
Whenever I used a project, apart from the source files and the bin and obj folders I had a .depend and a .layout file. All good.
Now I created a new project, and just copied -> pasted everything new in source files. I did this twice.
For each case, I have a .c.save file, which has the same name of the implementation file (ie. the implementation file is called imp, then the file is called imp.c.save). I asked a friend of mine what it might be, and he said I need to beware as he had two random files created, which prevented him from building correctly (he got a stupid error). When the files were deleted everything went back to normal.
I did a short test of the program and I can find nothing different. I am hesitant to delete it since this cropped up twice in two cases, but I don't want to compromise my coding.
Tried to google and I didn't find much. Any help?
Well, it didn't cause any problems so I assuming it is an autosave file.