User forums > Using Code::Blocks

Using libs

(1/1)

dkaip:
Hello.
From File>New>Project>Static lib> C:B makes automaticaly the libaaaaaaa.a library at C:\Documents and Settings\Owner\Desktop\New Folder\aaaaaaa\bin\Debug dir, that contains only ...
int SampleAddInt(int i1, int i2)
{
    return i1 + i2;
}
by default.
Then from File>New>Project>Console application i made the bbbbb.cbp in c language with code...

#include <stdio.h>
#include <stdlib.h>
int main()
{
    printf(SampleAddInt(2,3));
    return 0;
}

From Build options>debug>Link libraries>Add>, choozing ..\aaaaaaa\bin\Debug\libaaaaaaa.a and then runs the program crashes

ans says... ppName: bbbbb.exe    AppVer: 0.0.0.0    ModName: msvcrt.dll  ModVer: 7.0.2600.5701    Offset: 000323e4

Process returned -1073741819 (0xC0000005)   execution time : 12.531 s
Press any key to continue.

Any idea in this very simple problem?









scarphin:

--- Quote from: dkaip on February 15, 2014, 12:13:15 pm ---    printf(SampleAddInt(2,3));

--- End quote ---
What makes you think this is a CB problem?

dkaip:
What else, the two projects made by default....

dkaip:
I am trying different code ...Maybe is code problem ...Yes code problem ...
#include <stdio.h>
#include <stdlib.h>

int main()
{
  int i=SampleAddInt(2,4);

      printf("%i\n",i);
    return 0;
}
------------------------------
But in c++ i have problem ...

--- Code: ---#include <iostream>
using namespace std;
int main()
{
    int i=SampleAddInt(2,4);
    cout << i << endl;
    return 0;
}

--- End code ---

'SampleAddInt' was not declared in this scope ...





Jenna:
Please read the forum rules and a programming tutorial for beginners.

This forum is not dedicated to teach the very basics of programming and therefore the topic violates our forum ruls.

Topic locked !!

Navigation

[0] Message Index

Go to full version