News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

problem in compiling an application source file with C:B

Started by parisa_k, August 26, 2008, 09:30:32 AM

Previous topic - Next topic

parisa_k

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

McZim


parisa_k

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

McZim


parisa_k

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?

McZim

run application with valgrind. Example: valgrind ./bla-bla
and see what problem, which string in source code.

parisa_k

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

McZim


parisa_k

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?

parisa_k

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

McZim

i think you need create empty project and add all files.

parisa_k

#11
that`s exactly what I did but it couldn`t run successfully ...is it possible for you to test the code yourself

McZim

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.

parisa_k

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)


Jenna

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.