R
R
rmk2013-01-19 16:58:17
C++ / C#
rmk, 2013-01-19 16:58:17

Compiling a Project in NetBeans

Hello!

I want to build a MySQL-enabled C project using NetBeans:

gcc -I/usr/include/mysql -DBIG_JOINS=1 -fno-strict-aliasing -g -L/usr/lib/x86_64-linux-gnu -lmysqlclient -lpthread -lz -lm -lrt -ldl   -c -g -I. -o build/Debug/GNU-Linux-x86/main.o main.c
gcc -I/usr/include/mysql -DBIG_JOINS=1 -fno-strict-aliasing -g -L/usr/lib/x86_64-linux-gnu -lmysqlclient -lpthread -lz -lm -lrt -ldl    -o dist/Debug/GNU-Linux-x86/actualizer build/Debug/GNU-Linux-x86/main.o

I get the following output:
build/Debug/GNU-Linux-x86/main.o: In function `main':
/home/rmk/C/actualizer/main.c:17: undefined reference to `mysql_get_client_info'
collect2: выполнение ld завершилось с кодом возврата 1
make[2]: *** [dist/Debug/GNU-Linux-x86/actualizer] Ошибка 1
make[2]: Выход из каталога `/home/rmk/C/actualizer'
make[1]: *** [.build-conf] Ошибка 2
make[1]: Выход из каталога `/home/rmk/C/actualizer'
make: *** [.build-impl] Ошибка 2


If you change the order of the arguments in the compilation line, namely, move the connection of the mysql libraries to the end, everything is assembled normally:
gcc -o build/Debug/GNU-Linux-x86/main.o main.c -I/usr/include/mysql -DBIG_JOINS=1 -fno-strict-aliasing -g -L/usr/lib/x86_64-linux-gnu -lmysqlclient -lpthread -lz -lm -lrt -ldl   -c -g -I. 
gcc -o dist/Debug/GNU-Linux-x86/actualizer build/Debug/GNU-Linux-x86/main.o -I/usr/include/mysql -DBIG_JOINS=1 -fno-strict-aliasing -g -L/usr/lib/x86_64-linux-gnu -lmysqlclient -lpthread -lz -lm -lrt -ldl


Actually, questions:
1) Tell me, how can I change the order of arguments in the NetBeans compilation line?
2) Is there any other free IDE for Unix C under Linux Mint (Ubuntu)?

Thanks in advance.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
rmk, 2013-01-19
@rmk

Solved a problem.
The point is that NetBeans has a specific way of adding compilation options. It is described in more detail here:
http://forums.netbeans.org/topic44500.html

J
jov, 2013-01-19
@jov

Code::Blocks

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question