while trying to compare times between two different ways of determing whether a number is odd/even without using modulo, i thought of using long long ints which my codeblocks compiler aint supports .
and so i installed pelles c.( supports c99/c11 which inturn supports long long stuff.. )
and im down with linker errors. problems :

  1. i dont understand much what they are ,
  2. google led me to some pelles c forum threads where the discussion went above my head ( note : but it was related to the problem i had )
  3. i tried looking into pelles c help (which is raather nice bdw) but didnt find (didnt know where to look maybe) much.

can someone help me getting these things sorted ?
this is my code :

#include<stdio.h>
#include<time.h>
int main(){
    long long int i = 0, y =0 , x = 7985463214932541; // x  = a very big odd number
    clock_t t1,t2;
    printf("starting..\n");
    t1 = clock();
    for(i = 0 ; i < 500000000 ; i++){
        if(x&1) y=1;
    }
    t1 = clock() - t1;
    y=0;
    t2 = clock();
    for(i = 0; i < 500000000 ; i++){
        if(((x/2)*2) != x ) y=1;
    }
    t2 = clock() - t2;
    printf("bitwise time : %15ld\n",t1);
    printf("\nmul-div time: %15ld",t2);
    return 0;
}

also , while creating a new project in pelles c, i get tons of options as tp the project type , im just lerning c as of now , basic stuff.. so which one should i choose there ??

any help would be immensely appreciated !

Specific error messages would be helpful...

@rubberman :

Building LearningC.exe.
POLINK: error: Unresolved external symbol 'WinMain'.
POLINK: fatal error: 1 unresolved external(s).
*** Error code: 1 ***
Done.

update : something weird happend just.

  1. after installing pelles c, even when im using gcc commands on command line , (so i think im using the old compiler) the newer long long int versions are being supported , ie not getting any compile time errors for it.
  2. clock() is giving time like 1 , 2 etc ... which i dont think how it should give.

POLINK: error: Unresolved external symbol 'WinMain'.

You're trying to compile the project as a Windows application rather than a console application. Windows applications use a different entry point called WinMain. This is an easy one to fix, just change the appropriate setting for your project to build a console application.

commented: thanks :) +3

thanks :) all those options at start of a project got me ...
but , regarding the 2nd issue ,when i compile like
gcc -o test test.c from command line , i am compling with the old gcc compiler right ? so if the code has long long int in there , which isnt supported before c99 , shouldnt i get a compile time error ?

also , currently , i compile my codes in these two steps :
1. gcc -o test test.c
2. test
from windows defaylt cmd,

i tried to compile from pelles 's command line using the cc /Ze test.c command i found in here, but it gave me a lot of errors . i couldnt copy paste them here as it lacked enough readabilty, so im uploading a screenshot of the errors.

can you help me out with this one too ?

gcc -o test test.c from command line , i am compling with the old gcc compiler right ? so if the code has long long int in there , which isnt supported before c99 , shouldnt i get a compile time error ?

The default mode for gcc is -std=gnu89, which IIRC does include support for a form of long long.

i tried to compile from pelles 's command line using the cc /Ze test.c command i found in here, but it gave me a lot of errors .

Those are all from Kernel32.lib. Pelles C should just work right out of the box, so I'm not sure why you're getting those errors as they're an internal detail. Check your linker settings to ensure that all of the Win32 libraries are included.

if i execute from the ide , its working , but if i try to do it from cmd , its not. i really have no idea what to do here. mine is a 64bit system , do you think that has to do anything with it ?

Using Pelles C, you should use the compiler in the IDE. Whatever options you want, you can change the compiler flags being passed to the compiler, right in "Project" ---> "project options".

That way you don't have to keep keyboarding in a bunch of flag options. I use the default options a lot. Use "enable Microsoft extensions", for any program that uses the "windows.h" include file. You should read up on the Pelles C introduction which is included in the help section. There's a lot of stuff there. ;)

The type of project I use is Win32 console. It supports big integers (up into the billions), with unsigned long long int. I have the x64 version (because the PC has a 64 bit OS with 64 bit hardware, but I just don't need anything more than several billion. (I got used to using a work around for counting up as high as I want, from DOS days).

For help with Pelles C, absolutely the best thing is to register (free), on the Pelles C forum, at:
http://forum.pellesc.de/index.php

They have a "Beginner section", although you aren't limited as to where you want to read or post. LOTS of good stuff on there, and you WILL need it, from time to time, so sign up!

Your compiler errors are a result of an earlier error in your program. Post the code, and remember to use the compile button in the IDE, not the command line.

commented: lots of helpful details :) +3

and remember to use the compile button in the IDE, not the command line.

it runs as it should with the 'execute' button in the ide , but cmd still no go.

ill sign up there :)

bdw , im sure people (including me) would like to know that workaround you mentioned. maybe post a new thread regarding that ?

going by deceptikon's advice regarding using a console application , and adak's advice regarding compiling/executing from within the ide , the original problems are no longer coming up.
marking this thread solved.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.