runing a C project with multibule files on Visual studio - c

Hello guys i'm working on Payment application that are built in C
and i'm trying to test the function (getcardholdername) but it did't worked
image of the function and test function
I tried to add it at the main function and run the program but it didn't work
i'm new to C so i don't if i'm compiling the program right or wrong
image of the main function

Related

Ufft example compilation

I want to run the example project which is available for free from this link. It is a simple FFT library and needs no compiler. In it, there is an example c file with its required header files and .c files.
When I try to run it in Vivado SDK I get errors of multiple definitions of fft and ifft. How can I run this example inside SDK?
What I had done is created an empty application project and then imported all these files inside src folder and then selected build the project option but didn't succeed in building and running the project.
I guess, looking at the ufft.zip archive, that you've tried to link files issued form the compilation of fft-dit.c and fft-dif.c.
Both files define ftt functions using differents method (see README).
You have to choose betwen using ftt-dif.c or ftt-dit.c, not both.
This is the same for itt-dif.c and itt-dit.c, choose one, not both.

Why can't I call this C function from my Swift code?

I am trying to call this C library from my Swift code. I dragged the source files into my project and created a module.map file and added the directory containing the module map to Build Settings->Search Paths->Import Paths.
It seems to work. I can import the library and the name even shows up in autocomplete:
And I can access functions from the library and again autocomplete knows they are there:
But when I build, I get this error:
This name, "_mtex2MML_parse", is the same as the name of C function I'm trying to call except prefixed with an underscore.
I've gotten this same error before in similar circumstances trying to get cmark to work, but fixed it there by making sure that the .c file was included in the Target Membership, and then everything was fine. When I fiddled with doing that in this project, I've not had any luck. And in that case, autocomplete didn't even know about the function.
I've tried cleaning, deleting derived data, quitting Xcode, restarting computer, etc. I've tried on Xcode 8.3.3 Swift 3.1 and on Xcode 9b4, Swift 4.0. I'm on macOS 10.12.6. There is no other thing in the project besides this.
Can anyone offer any advice on how to proceed? Thanks.

You must select a host application to "run" a library

I am working with Code::Blocks and trying to program with the C language. I have created a header file, an implementation file and the main. When I compile, I have no errors, but when I run it I get the following error.
You must select a host application to "run" a library...
The libraries are all in the same folder.
I also did include the header files in my main program.
I have tried on 2 different PCs, and it didn't work. i tried with a different piece of code and it worked flawlessly.
What should I do?
Thanks.
EDIT: Solved.
Go to Project -> Properties -> Build Targets
From the 'Type' drop down list select 'Console Application' (in my case).
Seems like you have created dll. Change to executable.
You may find details how to fix it/
Properties -> Build Target -> 'Type' -> Console application
https://stackoverflow.com/a/8506935/2648826
You have it set up to build a library, not an application.
In File->New Project, you need to choose 'console type'

chipmunk and codeblocks undefined reference error

I built chipmunk with the codeblocks project file and have linked to the libchipmunk.a file but I am still getting 1 error when trying to built the hello world sample file.
Undefined reference to 'cpBodySetPos'
Any body know how to fix this?
Its either you haven't linked the libchipmunk.a file properly in the linker tab or if it an older version of chipmunk, then the generated libchipmunk.a file does not contain the declaration/definition of the cpBodySetPos().
To link libchipmunk.a file:
Open the project file.
Then right click on the project (from the left pane) and click "Build Options."
In the window, on the left there should be , Release, Debug.
Select your project name, then click on the "linker" tab.
From there, add the library into link libraries.
If you're using windows, you'll have to manually find the library, or in linux, just type "chipmunk" and gcc/ld should do the rest for you.
Also do refer this link to find out if you are generating the libchipmunk.a file properly for codeblocks and from the latest version of chipmunk.

Setting up an Xcode project with many individual example files

I'm playing around with lots of little C files whilst going through a book. Eg:
defs.h
chapter01
pointers.c
structPointers.c
vectorOps.c
defsTest.c
chapter02
selectionSort.c
recursion.c
bubbleSort.c
etc…
I'm currently using a great little app called CodeRunner, but I do miss the debugging and intellisense features in Xcode.
Is there a way to set it up the project so I can run each file individually from within the one project? I know I could always make a single workspace with a project for every single file, but that seems very cumbersome – there's gotta be a better way.
1)
Yep. Using the command line (you have to install the "Command Line Additions" that you can download from the "Looking for additional developer tools" link on this page building can be as easy as:
gcc -o selectionSort selectionSort.c
(provided you have a "main" function in your .c file).
Or:
2)
To build from within the Xcode IDE, you'd have to create a new product (or target) for each little app you want to build and add the appropriate .c file you want to build to that new product. The type of app you'd be building would be called a "Command Line Tool".
When you create a new project or select "New Target", this is what you would see and select:

Resources