Author Topic: How to open linux c++ project on codeblocks?  (Read 14415 times)

Offline jinjin12

  • Multiple posting newcomer
  • *
  • Posts: 13
How to open linux c++ project on codeblocks?
« on: December 27, 2013, 03:46:34 am »
I created project with several c++ files  and .h files and a makefile on ubuntu. first of all, i only use text editor, terminal, and gcc for the project, no third party IDE or anything like that on my ubunu. I placed all these files in a folder called "stuff" and transfer it to my windows xp with codeblocks on it.

now how do i open these files as a project on codeblocks?  i tried selecting "open" from the codeblocks menu but codeblocks has trouble opening all the files and compiling and running them?  i see and "import" option but tha'ts only for bloodshed c++ files and MS visual c++ files..

Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: How to open linux c++ project on codeblocks?
« Reply #1 on: December 27, 2013, 05:36:34 am »
Create a new empty project (file -> new -> project, empty project), choosing a project folder somewhere near the sources you are trying to compile (e.g. in the same directory)
Select project -> add files... to add the sources, which you will then see under the project in the "projects" tab of the management side bar.
Select project -> properties -> check this is a custom make file, press OK.
Then goto project build options to specify makefile commands for each target (you can also set global variable substitutions and pre/post build steps)
(You can add/remove targets in project -> properties -> build targets -- I am not sure whether the "Selected build target options" do anything when you specify a custom makefile, but I think things work pretty well if you have target name that match up with targets in the makefile. Would be great if source and target detection were automatic, but alas...)

Offline jinjin12

  • Multiple posting newcomer
  • *
  • Posts: 13
Re: How to open linux c++ project on codeblocks?
« Reply #2 on: December 28, 2013, 04:38:19 am »
Create a new empty project (file -> new -> project, empty project), choosing a project folder somewhere near the sources you are trying to compile (e.g. in the same directory)
Select project -> add files... to add the sources, which you will then see under the project in the "projects" tab of the management side bar.
Select project -> properties -> check this is a custom make file, press OK.
Then goto project build options to specify makefile commands for each target (you can also set global variable substitutions and pre/post build steps)
(You can add/remove targets in project -> properties -> build targets -- I am not sure whether the "Selected build target options" do anything when you specify a custom makefile, but I think things work pretty well if you have target name that match up with targets in the makefile. Would be great if source and target detection were automatic, but alas...)


god that was long just to run some simple files with a makefile already available...and it still gave me some errors.

thank god i have mingw and i just right clicked for windows xp command prompt, way faster...