CodeBlocks Help: How to Compile created file - codeblocks

so I am new to this community and this is my very first question hope someone can help me! :)) I've started to download this so called code blocks IDE for me to code.. so far so good when I am about to run my program, it was compiling main.c (the pre-created file when you create a new project) not the file I was working on. Hope someone helps me..More Power!
PS: I am using codeblocks v16.01

The automatically generated code::blocks projects have their own "hello world" source file in them. What you probably want to do take this main.c file out of the project and then add your file to the project. Or to copy and paste your entire code to substitute main.c content.

Related

Building GLFW for codeblocks

I'm trying to build GLFW from source for Code Blocks. I used Cmake and it made a directory and I opened the Code blocks project file and clicked the gear to build. The only thing new in src is libglfw3.a and I'm not sure what to do with it.
I think you're following the LearnOpenGL tutorial. Actually, i tried to do the same as he recommended, but i ended up following this tutorial which is way more simple to apply https://www.youtube.com/watch?v=0WrSGMuU964&t=0s . It's using the pre-compiled binaries folder, that's why it is not using Cmake. To make it short (under windows), you only need to copy/paste the include and lib-mingw folders in your project folder. Then open your project with Code::Blocks and go in Project/Build options... . In Search directories under the compiler tab, you need to add the include directory you just copy/pasted and under the linker tab, you do the same thing with the lib-mingw dir. Now in the linker settings tab (next to search directories) you need to add glw3, gdi32, and opengl32, and that's all it should be working now :) I only wrote the tutorial in case one day it disappears from youtube :p
This was posted a while ago but I think I built the static GLFW library for linux with WSL CMake instead of Windows CMake.

running cpp project with cmake (mac)

My question is very naive. Every time I ran an algorithm, it's with an IDE so I don't know exactly what is generated in backgrown.
I try to run with my MacBook an algorithm that I didn't write and I'm blocked !
In the readme file: they said "Use cmake to generate desired projects on different platforms. (See “CM.txt” in the
“src” folder)"
In the CM.txt:
project(BlProj)
cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
add_executable(BlProj
main.cpp
thi.cpp
thu.cpp
mat.cpp
Config.cpp
Stringer.cpp
)
I did: cmake CM.txt
A CM directory is generated. I will not list all the files inside: it's some cmake, bin, out, cpp, c, cxx, log, txt files.
I don't know what I can do with that!
I'm supposed to generate a compiled binary and run it with the command:
./BlProj data1 data2 10 config output
But it wasn't generated...
So I don't know how I can have the BlProj executable. Could you help me?
How do the cpp compilation work? What did cmake exactly?
Is cmake CM.txt is a good practice or not?
You can use cmake-gui to build sources.
go to CMAKE installation directory and inside bin folder run cmake-gui
Provide input where the source code is and provide an input where to build.
hit on configure and then generate.
you might need to select IDE version as well as provide additional input, it depends.
once done open generated project files with your IDE and build.

Running or modifying the source code(binaries) that are available under GNU General public license

Dear stackoverflow members,
I have a question that might sound silly to most of the members here, but it is bothering me for quite a while now and couldn't find any appropriate answer for it, yet.
My question is, how can we run a source code or binary of a open source project which is distributed under GNU license.
When I download the project, all I get is a .tar file, when unzipped, I get a folder containing many sub-folders, like src, build and etc. This folder looks similar to the project folder created by an IDE like netbeans. But how can I compile and modify these source file?
Is there an application that does it? or do i have to switch to linux to do it?
I am currently using a copy of windows 7 and also have a copy of windows xp at disposal.
Any help would be very much appreciated.
Thank you very much in advance.
cheers
Kishore.
Under GNU and GNU/Linux distros the packages are installed by the package manager (e.g. no need to build or download anything). Some programmers distribuite (along with the source code) binary versions of the program (which you run by clicking on them, or by invoking them from the command line). You can compile source code on Windows thanks to MinGW. For the istructions to run read the `README' file that you find in the unpacked dir. Most programs can be build with:
./configure; make; make install
If you post the link to the project I could help you with the building process.

Using Google's ProtoBuf (and a .proto file) to create a Python API Library

I have the .proto file used in the open-source Android API (http://code.google.com/p/android-market-api/), and am having some trouble compiling the file to generate the .py.
I'm trying to follow the instructions here, https://developers.google.com/protocol-buffers/docs/pythontutorial , and am on the steps that are under the header "Compiling Your Protocol Buffers".
I've downloaded the compiler, protoc.exe. The readme says "To install, simply place this binary somewhere in your PATH," which I'm not understanding. I'm messed around with it for a while now, but can't think of how to proceed.
I'm quite the novice programmer, so please tell me if something isn't clear, or if I'm having some sort of fundamental misunderstanding... about anything. I'm on Windows 7 by the way.
Thanks!
if protoc.exe is not in the same directory you're calling it from, you need to add it to your PATH environment variable to be accessible from the calling directory when you're in the shell. open up a command shell and execute:
set PATH=%PATH%c:\directory\to\proto\executable;
then change directories over to where your source code is and execute the compilation line as instructed from the google page.
I had the same problem because it is not written that clear in the README.txt. What they mean is to:
1. take the protoc.exe and put it in the same folder with the other files of your project.
2. open the cmd to that directory and run: protoc --cpp_out=. myfile.proto
=> This will create the 2 new files in the folder with the files of your project, and then you can add them normally to your program.
This helped me: http://www.scriptol.com/programming/protocol-buffers-tutorial.php
This is for c++, but I guess it will be something similar for python; I guess you just have to change the command you are using in the cmd :)

Configuring Bison to compile an input file under Visual C 6

I'm trying to get Bison to do it's thing in VC6. I'm sure this must be a problem with my configuration. At the moment I have a Custom Build step as follows.
<Commands>
echo Start parser generation
"C:\GnuWin32\bin\bison.exe" $(InputPath)
echo Finish parser generation
<Outputs>
$(ProjDir)\$(InputName).c
$(ProjDir)\$(InputName).h
The error I get is "C:\GnuWin32\bin\bison.exe: m4: No such file or directory", which makes me think the m4.exe doesn't exist or isn't on the path, but I can run the exact same command from CMD in the same directory with no errors.
This thought process makes me think it's a problem with the output options, but I've tried various configurations with no luck.
Any help would be great, thanks in advance.
Edit: I've added some more visual studio versions to the tag list to try to get some more exposure for the question. Hopefully someone will have done this in a later version and I can work backwards.
Okay, I've managed to slove this in a very round-about way but I will try my best to document it here.
It seems that VC6 Custom build options will only look in the project directory for the m4.exe, even when you specify where the calling exe (bison) is explicitly. To solve this I did a bit of a hack and did a full cd command in the custom build window to get to the gnuwin32 directory (where both bison and m4 live) before trying to call the parser generator.
This works fine but is a bit of a hassle for trying to distribute it to other people when they may have installed GNU tools to a different location.

Resources