Author Topic: Using libs  (Read 3232 times)

Offline dkaip

  • Multiple posting newcomer
  • *
  • Posts: 42
Using libs
« on: February 15, 2014, 12:13:15 pm »
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?










Offline scarphin

  • Lives here!
  • ****
  • Posts: 644
Re: Using libs
« Reply #1 on: February 15, 2014, 12:23:53 pm »
    printf(SampleAddInt(2,3));
What makes you think this is a CB problem?

Offline dkaip

  • Multiple posting newcomer
  • *
  • Posts: 42
Re: Using libs
« Reply #2 on: February 15, 2014, 12:53:00 pm »
What else, the two projects made by default....


Offline dkaip

  • Multiple posting newcomer
  • *
  • Posts: 42
Re: Using libs
« Reply #3 on: February 15, 2014, 01:06:06 pm »
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;
}

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





« Last Edit: February 15, 2014, 01:17:32 pm by dkaip »

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Using libs
« Reply #4 on: February 15, 2014, 01:28:00 pm »
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 !!