User forums > Using Code::Blocks

Creating a project file from existing source code and header files?

<< < (2/2)

dominover:
I'll explain it another way.
What I'm trying to do is this.

I am using code::blocks.
It has an avenue to create projects in FLTK.  I have FLTK and have build it and it is working.

If I want to take some of the example files from the working examples provided (and I have seen them working) and build them myself, I have a .h file and a .cpp file

If I create a new FLTK FLUID based project in code::blocks it gives me a project file, a header file and a cpp source file. 

You would think I could just copy and past the contents of each FLTK source and header file to the one generated in the code::blocks project window but it's not as simple as that.  The project file also needs updating because if you open it up in a text editor you will see the names of all the source and header files it will be expecting to see.

Now... If I have dozens of header files and dozens of source files its simply not practical to do this.  A big waste of time actually.   I want to know if there is a way to navigate to the source and header files generated by FLTK (which is a gui toolkit by the way) and include them or turn them into a project,,, recognized as a project in codeblocks so I can compile it and do everything with it I would normally do if I had built the project from scratch in codeblocks myself.

I know there are a myriad of alternatives but I want create a project based on the header and source files I got from somewhere else.

Thanks :)  :'(

oBFusCATed:

--- Quote from: dominover on June 27, 2013, 01:30:39 pm ---I know there are a myriad of alternatives but I want create a project based on the header and source files I got from somewhere else.

--- End quote ---
You could probably modify the FLTK template. It is just a script, so you can right click on it and then edit it to suit your needs.

dominover:
Actually it won't.  How do you compile a gui into an exe file which opens the gui when you click on it (to put it simply) by altering the template?

I want to use code::blocks. I want to use code::blocks..  It will help allot to learn how to do this.

By altering the FLTK template I can generate code using FLUID which will need to be compiled in a compiler.  That compiler will be MinGW which has the means to create FLTK projects.  Lets imagine it is not FLTK for a second.  Something else where there is no alternative.

How would I use existing code to set up a codeblocks project without the copy and pasting of code ritual?

oBFusCATed:
Sorry but I don't understand what the goal of your last post is.

I've told you that the fltk project template in fact is just a script, so you can open it and modify it to suit your needs.
But I guess I don't understand what is your use case exactly. And now I'm sure that by 'Create project' you mean something else than the operation 'File -> New -> Project-> blabla'.

Keep in mind that there might be none of us that have used or uses FLTK, so you'll need to explain stuff better!

dmoore:
Here's one way:

1. Copy the files you need to some directory D
2. File ... New... Project... FLTK
3. Choose a name, the location etc, make sure the location of the CBP file will be in D
4. Project... Add files...  to add your source files to the project
5. In the project tree (manager pane) right click on the files that the wizard created and remove from project. (EDIT: You will also need to delete the files in a file manager if you want to truly be rid of them)
6. Save the project, build and run

Hopefully that should be it

Navigation

[0] Message Index

[*] Previous page

Go to full version