Author Topic: problem in compiling an application source file with C:B  (Read 12376 times)

Offline parisa_k

  • Multiple posting newcomer
  • *
  • Posts: 23
problem in compiling an application source file with C:B
« on: August 26, 2008, 09:30:32 am »
hi,
I want to use code blocks for compiling source of an applicaion .... (.tar file)
I have started a new project>console application and
according to the make file , I added the needed .c files and also I have added defines and libraries to the project build options (in both Debug and Release mode)....... but C::B cannot compile it ...why? where is the problem?  :?:
thanks

Offline McZim

  • Multiple posting newcomer
  • *
  • Posts: 36
Re: problem in compiling an application source file with C:B
« Reply #1 on: August 26, 2008, 10:47:01 am »
remove make file

Offline parisa_k

  • Multiple posting newcomer
  • *
  • Posts: 23
Re: problem in compiling an application source file with C:B
« Reply #2 on: August 26, 2008, 11:27:54 am »
I think  there is a misunderstanding....
I didn`t use  the make file...I just look at it to see which files are necessary for compile and making executable file

and then I added the necessary files to a new project in code::blocks.....

I also set the libraries and defines in build option...
but I don`t know what`s the problem

Offline McZim

  • Multiple posting newcomer
  • *
  • Posts: 36
Re: problem in compiling an application source file with C:B
« Reply #3 on: August 26, 2008, 12:36:45 pm »
what error?

Offline parisa_k

  • Multiple posting newcomer
  • *
  • Posts: 23
Re: problem in compiling an application source file with C:B
« Reply #4 on: August 26, 2008, 12:47:34 pm »
there is no error ....but its output in the Debug folder is and executable file that can`t run correctly ...the error is: segmentation fault
and there is nothing in release...it seems it can compile the file but cann`t build...........

I`m sure that the source file has no problem ....I have once compile it using its make file

but I`m not sure that whether it`s the correct way to compile source of an application or not... and what`s the correct way?
« Last Edit: August 26, 2008, 12:59:20 pm by parisa_k »

Offline McZim

  • Multiple posting newcomer
  • *
  • Posts: 36
Re: problem in compiling an application source file with C:B
« Reply #5 on: August 26, 2008, 08:01:28 pm »
run application with valgrind. Example: valgrind ./bla-bla
and see what problem, which string in source code.

Offline parisa_k

  • Multiple posting newcomer
  • *
  • Posts: 23
Re: problem in compiling an application source file with C:B
« Reply #6 on: August 27, 2008, 07:31:30 am »
here I exactly explaind my problem::


I have uploaded the sorce file here (it`s iozone (a filesystem benchmark) source code with some changes....

http://rapidshare.com/files/140436058/ii.tgz.html

you can make its executable file by using this command it terminal (in files path)
make linux
then you see it runs  correctly....
--------------------
but now I want to do the same thing with C::B
I start a new project> console application
then I add the source files to it ....and set defines and libraries (by looking at make file) to it ....

libraries: pthread , rt
defines:
NAME = "linux"
unix
linux
HAVE_ANSIC_C
ASYNC_IO
_LARGEFILE64_SOURCE
SHARED_MEM
HAVE_PREAD


I expect that when I run this project, the executable file become created....
but it doesn`t happen (perhaps because of some problems)...I want to know what is the problem and how to solve it (maybe the problem is with the way that I used)
I would be thankful if anyone can help
thanks
« Last Edit: August 27, 2008, 07:34:42 am by parisa_k »

Offline McZim

  • Multiple posting newcomer
  • *
  • Posts: 36
Re: problem in compiling an application source file with C:B
« Reply #7 on: August 27, 2008, 09:03:45 am »
how you call functions from "main" function.

Offline parisa_k

  • Multiple posting newcomer
  • *
  • Posts: 23
Re: problem in compiling an application source file with C:B
« Reply #8 on: August 27, 2008, 09:19:45 am »
I just added the .c files to the project and then run it ... no change in main.c....does it need to be called and how?
does it solve the problem?

Offline parisa_k

  • Multiple posting newcomer
  • *
  • Posts: 23
Re: problem in compiling an application source file with C:B
« Reply #9 on: August 27, 2008, 09:26:05 am »
I also removed the main.c from the project ...I think it can find the main() in iozone.c and will use it as the main function

Offline McZim

  • Multiple posting newcomer
  • *
  • Posts: 36
Re: problem in compiling an application source file with C:B
« Reply #10 on: August 27, 2008, 11:03:56 am »
i think you need create empty project and add all files.

Offline parisa_k

  • Multiple posting newcomer
  • *
  • Posts: 23
Re: problem in compiling an application source file with C:B
« Reply #11 on: August 27, 2008, 11:13:03 am »
that`s exactly what I did but it couldn`t run successfully ...is it possible for you to test the code yourself
« Last Edit: August 27, 2008, 11:18:58 am by parisa_k »

Offline McZim

  • Multiple posting newcomer
  • *
  • Posts: 36
Re: problem in compiling an application source file with C:B
« Reply #12 on: August 27, 2008, 01:29:08 pm »
i'm create empty project and add all files, but can't build project. I see many erros, for example: conflict types. I don't know what this should be working. I think problem with download files, but i can make mistakes.

Offline parisa_k

  • Multiple posting newcomer
  • *
  • Posts: 23
Re: problem in compiling an application source file with C:B
« Reply #13 on: August 27, 2008, 01:38:45 pm »
but it didn`t have any errors when I run it.....
the source file is correct because you can compile it using make file ....and after that the application can be run successfully.....
make linux
so it seems that C::B also should be able to run it ...but it cannot ...


but about the errors that you saw:

did you remove the main.c file.....
and did you add defines and libraries to build options..........
(Reply #6)


Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: problem in compiling an application source file with C:B
« Reply #14 on: August 27, 2008, 02:43:42 pm »
The first point is that this question is not really C::B related.

The second is that the code compiles with tons of warnings and is not really readable.

The third is that compiling it with C::B is quiet easy if you use the makefile, otherwise it needs some more tweaking.

And the fourth and most important is that you posted the link to the code just 6 hours ago and if nobody has answered your question in a way that it works for you means that nobody has an idea how to do that, or nobody wants to do your homework.

There is no cause to be impatient.