User forums > Using Code::Blocks

how to make driver program?

(1/2) > >>

questions2go:
Whenever I'm working in a project and create an empty file with a main, when I compile I get an error about there being multiple main functions. How can you make a small driver program?

Alpha:
This sounds to me to be more of a programming issue rather than a Code::Blocks issue (which means you should seek a programming forums, not here, for help - see forums usage guide).

You could, of course, check to see if the compiler's warning is valid (which it almost always is), and insure you only have one int main().

If this is your first experience with programming, it would be better with the standard hello world example.

stahta01:
Do an full rebuild after turning on compiler logging; it might show you are compiling/linking files you did not realize.

http://wiki.codeblocks.org/index.php?title=FAQ#Q:_How_do_I_troubleshoot_an_compiler_problem.3F

Tim S.

questions2go:
I think this problem is trivial so let me restate it. I'm not saying there's a problem wrong with the compiler.

If I'm writing a large program and want to make a small main file to test out 1 function, how can I do that? Must I create a new project in codeblocks?

C:\Users\Johnk\Image Transformation\main.c||In function 'main':|
C:\Users\Johnk\Image Transformation\main.c|80|warning: unused variable 'IMchr2'|
C:\Users\Johnk\Image Transformation\main.c|79|warning: unused variable 'IMchr1'|
obj\Debug\Desktop\SmallTest.o||In function `main':|
C:\Users\Johnk\Desktop\SmallTest.c|9|multiple definition of `main'|
obj\Debug\main.o:C:\Users\Johnk\Image Transformation\main.c|64|first defined here|
||=== Build finished: 2 errors, 2 warnings ===|

oBFusCATed:
You have 2 options:
1. create new project;
2. create new target inside the existing project (you have to include only a subset of the files in the project);

Navigation

[0] Message Index

[#] Next page

Go to full version