User forums > Using Code::Blocks

New to Code:.Blocks

(1/4) > >>

lbertolotti:
I was using a different IDE, but decided to check this one out, as it looked easier when linking libraries into c++. So I just copied a test file I was using before, but it didn't work:


--- Code: ---
#include <stdio.h>

int main()
{

int numero, somma;
somma=0;
printf ("inserisci un numero diverso da 0 come componente della sequenza, 0 per terminare la fase di acquisizione\n");
scanf ("%d", &numero);
while (numero != 0)
{
somma=somma+numero;
printf("inserisci un numero diverso da 0 come componente della sequenza, 0 per terminare la fase di acquisione\n");
scanf("%d", &numero);
}
printf("La somma dei numeri digitati รจ: %d\n", somma);

FILE *tab;
tab=fopen ("tabela.csv","w");
fprintf(tab, "Hello world");
fclose (tab);
printf("inserisci un carattere\n");
scanf("%d");
}


--- End code ---

Build log:

--- Code: ---Files (x86)\GnuWin32\lib\libgslcblas.a"
obj\Release\main.o:main.cpp:(.text.startup+0x0): multiple definition of `main'
obj\Release\gsl.o:gsl.cpp:(.text.startup+0x0): first defined here
collect2.exe: error: ld returned 1 exit status
Process terminated with status 1 (0 minute(s), 0 second(s))
1 error(s), 1 warning(s) (0 minute(s), 0 second(s))

--- End code ---

I get error: ld returned 1 exit status

Note: I am using Windows 8, SDK version 1.25.0, as for the complier I was using GNU GCC, what do u suggest I use? I was planning on playing around with GSL

stahta01:
Please read and follow the FAQ
http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28errors%29#Q:_How_do_I_troubleshoot_a_compiler_problem.3F

Please use code tags when posting code or build logs!

Tim S.

lbertolotti:

--- Quote from: stahta01 on July 22, 2015, 11:33:59 pm ---
Please use code tags when posting code or build logs!

Tim S.

--- End quote ---

Better now?

ouch:
Given your programs simplicity, I would just use CB's new project wizard to create a new console project and then just copy and paste your code as needed.

That will save you time from having to tell CB what you want, where you want it, and where everything else is...

BlueHazzard:

--- Quote from: lbertolotti on July 22, 2015, 11:58:24 pm ---
--- Quote from: stahta01 on July 22, 2015, 11:33:59 pm ---
Please use code tags when posting code or build logs!

Tim S.

--- End quote ---

Better now?

--- End quote ---

formatting is perfect  :D  , but we still need a full rebuild log to know exactly what you are doing

Navigation

[0] Message Index

[#] Next page

Go to full version