Author Topic: Folder symbolic links for c++ project  (Read 1872 times)

fpcarv

  • Guest
Folder symbolic links for c++ project
« on: July 05, 2022, 05:54:45 pm »
Hi everyone!

A simple case ;-)
I have a project CodeBlocks 20.03 folder (Linux) with the following files/folders:

drwxr-xr-x 6 francis francis 4096 jul  5 15:47 .
drwxrwxr-x 7 francis francis 4096 jul  5 11:13 ..
drwxr-xr-x 3 francis francis 4096 jul  4 23:53 bin
-rw-rw-r-- 1 francis francis 1559 jul  5 11:06 camServer.cbp
-rw-rw-r-- 1 francis francis 1225 jul  5 15:39 camServer.depend
-rw-rw-r-- 1 francis francis  790 jul  5 14:16 camServer.layout
-rw-rw-r-- 1 francis francis 1257 jul  4 10:26 common.hpp
-rw-rw-r-- 1 francis francis 2267 jul  5 15:47 main.cpp
drwxr-xr-x 3 francis francis 4096 jul  4 23:53 obj
drwxrwxr-x 2 francis francis 4096 jul  5 14:03 server
-rw-rw-r-- 1 francis francis  861 jul  5 00:10 s_packet.hpp
drwxrwxr-x 2 francis francis 4096 jul  5 00:13 toolbox

Inside camServer.cbp:

                <Unit filename="common.hpp" />
                <Unit filename="main.cpp" />
                <Unit filename="s_packet.hpp" />
                <Unit filename="server/LocalServer.cpp" />
                <Unit filename="server/LocalServer.hpp" />
                <Unit filename="toolbox/SocketIO.cpp" />
                <Unit filename="toolbox/SocketIO.hpp" />
                <Unit filename="toolbox/common.cpp" />
 

So far so good, the project compiles ok, but ... 
If I try to put some sub-folders someplace else, using symbolic links, the hell breaks loose!

ln -s /home/francis/RASP_PROJECT/server server
ln -s /home/francis/RASP_PROJECT/toolbox toolbox

From here, C::B jumps directly to the linked folders (ignoring the original folder structure) and the project becomes unusable :-(

drwxr-xr-x 4 francis francis 4096 jul  5 16:37 .
drwxrwxr-x 7 francis francis 4096 jul  5 11:13 ..
drwxr-xr-x 3 francis francis 4096 jul  4 23:53 bin
-rw-rw-r-- 1 francis francis 1559 jul  5 11:06 camServer.cbp
-rw-rw-r-- 1 francis francis 1225 jul  5 15:39 camServer.depend
-rw-rw-r-- 1 francis francis  790 jul  5 14:16 camServer.layout
-rw-rw-r-- 1 francis francis 1257 jul  4 10:26 common.hpp
-rw-rw-r-- 1 francis francis 2267 jul  5 15:47 main.cpp
drwxr-xr-x 3 francis francis 4096 jul  4 23:53 obj
lrwxrwxrwx 1 francis francis   33 jul  5 16:36 server -> /home/francis/RASP_PROJECT/server
-rw-rw-r-- 1 francis francis  861 jul  5 00:10 s_packet.hpp
lrwxrwxrwx 1 francis francis   34 jul  5 16:37 toolbox -> /home/francis/RASP_PROJECT/toolbox

All the include files seem to be expected be inside RASP_PROJECT, not at their original places, ignoring camServer.cbp!
The Project File Explorer became a mess, while none of the linked file locations match their original locations.

Am I doing something wrong?
No, it has nothing to do with the raspberry, this machine (x86) is running Ubuntu  22.04, not doing cross compiling.

Many thanks in advance,

-Francisco






Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: Folder symbolic links for c++ project
« Reply #1 on: July 05, 2022, 10:11:45 pm »
Symbolic links are probably not supported... I never have tried them...

Quote
From here, C::B jumps directly to the linked folders (ignoring the original folder structure) and the project becomes unusable :-(
can you explain a bit better what happens? Is the project tree messed up? Is compiling messed up?
If the first, can you provide some screenshots? If the later, can you provide some build logs?

Quote
The Project File Explorer became a mess, while none of the linked file locations match their original locations.
Can you show some screenshot?

I do not know your use case for using symbolic links in a project, but it is not really portable and i personally think it is counter productive to use symbolic links for source code... I would suggest to use something like git with submodules instead of symbolic links, with the additional benefit to have version control..