Setting Up a GNU Make project (GCC)
This document guides you through the process of creating a new HOOPS Exchange project using GNU Make and GCC.
Requirements
Check your system documentation to install the make
command as well as the base C development tools.
Also, make sure your development environment is supported by HOOPS Exchange.
Project
Make a folder for your new project, and create a file called Makefile with the following content:
CC = gcc
PROJECT = ExchangeApplication
SRC = main.c
EXCHANGE_INSTALL_DIR =
CFLAGS = -I$(EXCHANGE_INSTALL_DIR)/include
LDFLAGS =
all: $(PROJECT)
$(PROJECT): $(SRC)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^
clean:
rm -f $(PROJECT)
.PHONY: all clean
Add another file called main.c with the following code:
#include <stdio.h>
#include <A3DSDKLoader.h>
int main(int argc, char* argv[])
{
if(A3DSDKLoadLibraryA(EXCHANGE_BINARY_DIR)) {
A3DInt32 major, minor;
A3DDllGetVersion(&major, &minor);
printf("HOOPS Exchange %d.%d loaded\n", major, minor);
A3DSDKUnloadLibrary();
}
return 0;
}
Compile And Run
From your command line interface, change to the directory containing your Makefile and run the following command:
make EXCHANGE_INSTALL_DIR=path/to/exchange
path/to/exchange is the folder path to your Exchange installation directory (the folder containing include/).
Upon running your program, you should see Exchange version appearing in the standard output.
You’re ready to jump to our next tutorial: Initializing HOOPS Exchange.