Re: C/C++ Support

slipbits <[email protected]>
Newsgroups gmane.comp.java.ide.netbeans.user
Message-ID <[email protected]>
I have tried to build using cygwin in a Win11 environment.

The Win PATH variables contains the path to the location of the shared 
libraries, C:/cygwin64/lib/gcc/x86_64-pc-cygwin/12/.

The build command I use is:

         C:\cygwin64\bin\g++.exe -c *.cpp

And when I use cygpath -u 'C:\cygwin64\bin\g++.exe' 
becomes/usr/bin/g++.exe -c *.cpp, and /usr/bin/g++.exe exists.

On a build I get:

C:/cygwin64/lib/gcc/x86_64-pc-cygwin/12/cc1plus.exe: error while loading 
shared libraries: ?: cannot open shared object file: No such file or 
directory

Doing cygpath -w 'C:/cygwin64/lib/gcc/x86_64-pc-cygwin/12/' becomes 
/usr/lib/gcc/x86_64-pc-cygwin/12 and 
/usr/lib/gcc/x86_64-pc-cygwin/12/cc1plus.exe exists.

My guess is that g++ can't find cc1plus.exe, or that cc1plus.exe can't 
find the shared libraries, but I don't understand why not. PATH includes 
the shared libraries, and I suspect that cc1plus.exe either has the path 
hard coded or looks at PATH.

The email below that Ulf was able to use Netbeans in a Linux environment 
to, at least, build, clean and execute code, but I can't seem to get the 
same result in Windows. Does anyone know why?

As a separate question, is there any reason that compiling a single file 
is not allowed?

thanks;
art

On 3/4/2025 3:22 AM, Ulf Zibis wrote:
> Hi Art,
>
> yes, I can build, clean, run and debug my Project with the given 
> commands.
> "Compile" is grayed out either here, regardless, what is put in the 
> Editor->"Compile Commands" field.
> I guess, I could also use `make install` and `make clean` for "Build" 
> and "Clean".
>
> For debugging, `gdb` must be installed.
>
> I guess on Windows you must use Windows style commands.
> And I think, there is no limitation for the length of the commands, so 
> no need for line continuation characters.
> But you can execute multiple commands, if you put them in separate 
> lines as you can see in my example.
>
> Yes, I compile into the project directory and move the generated 
> object into the plugin directory of my application at same time with 
> "Build". I also could use `cc ... -o /home/ich/.jpilot/libmedia.so".
>
> -Ulf
>
> Am 04.03.25 um 06:12 schrieb slipbits:
>> Hi Ulf;
>>
>> Does it work? If so, great. If not, not so great.
>>
>> You have one advantage over me, an integrated environment (Linux). I 
>> have a mixture of Windows and Linux, and in this environment without 
>> feedback, I'm lost.
>>
>> I notice your compile command  (cc -ggdb -fPIC -shared)  puts the 
>> generated object file into the same directory as the header and 
>> source files. Was that your intent? One issue that I have is that I 
>> want to put the generated object files in another directory. In order 
>> to do that, I have to pass the file name to one of the g++ parameters 
>> (g++ -c -o obj/<filename>) and there are no directions as to how to 
>> do this.
>>
>> I guess a common issue would be a compile/build command that is 
>> large. I haven't tried this so I don't know if a line continuation 
>> character ('\' in Linux) has to be provided or whether the input 
>> 'line' extends to as large as is needed. Another feature that needs 
>> experimentation.
>>
>> But, if it works for you then that is great.
>>
>> art
>>
>> On 3/3/2025 4:33 PM, Ulf Zibis wrote:
>>> Hi Art,
>>>
>>> I now learned, that the `cc` option `-s` means "strip" (I copied the 
>>> command from elsewhere). When I omit it, the debug symbols, created 
>>> by option `-ggdb` were not removed again from the binary.
>>> Now, what a surprise, I can debug my code with NetBeans. Wow, that's 
>>> great.
>>>
>>> So now I have:
>>> Compile Commands:
>>>     cc -ggdb -fPIC -shared
>>> Build:
>>>     cc -ggdb -shared -fPIC media.c -o libmedia.so
>>>     mkdir -p /home/ich/.jpilot/plugins
>>>     mv libmedia.so /home/ich/.jpilot/plugins/
>>> Clean:
>>>     rm -r /home/ich/.jpilot/plugins
>>> Run:
>>>     jpilot -d
>>>
>>> -Ulf
>>>
>>> Am 03.03.25 um 17:33 schrieb slipbits:
>>>> Hi Ulf;
>>>>
>>>> Way back in the bottom of this email, I asked about C/C++ support. 
>>>> Some answers followed.
>>>>
>>>> I work in a Windows environment and have cygwin (a Windows Linux) 
>>>> with mingw and gcc.
>>>>
>>>> There is no documentation of what is required for entries in 
>>>> "Compile Command", "Build", "Clean" or "Run". So, I've tried 
>>>> different versions of paths to reference the gcc toolset. So far, 
>>>> none have worked, except for "Clean". What is more than puzzling is 
>>>> how to specify what is being compiled to the compiler. In my case, 
>>>> I would like to use something like "g++ -c -o obj/?"  where the "?" 
>>>> is a question as to how I can specify that the object file created 
>>>> goes to a separate directory.
>>>>
>>>> This means that I have given up. My current procedure is to use g++ 
>>>> directly in a script or by typing in a bash shell. I use:
>>>> g++ -c obj/$1 $1 in a bash script to compile a file, and
>>>>     for i in *.cpp; g++ -c obj/$i.o $i 2>> error.log; done. To 
>>>> compile everything and save the errors.
>>>>
>>>> Don't really know what else to do.  There are no descriptions to 
>>>> follow, nothing to say "hey, this is the correct way to do things", 
>>>> and there hasn't been since NB 8.0. Without any guidelines it 
>>>> becomes a matter of experimentation. And when you run out of ideas, 
>>>> why then, your done.
>>>>
>>>> As a suggestion, if you are having undue difficulty then separate 
>>>> the compile, build, run and debug tasks from NB and do it 
>>>> externally. That allows you to go forward. Otherwise you may be 
>>>> experimenting for a bit.
>>>>
>>>> As another note, for referencing CCLS or clangd, go to tools -> 
>>>> options -> C/C++. I have no idea whether it works but I use
>>>> "C:\cygwin64\usr\clangd\bin\clangd.exe". Note that there is a 
>>>> selection you have to make at the bottom, "Preferred server".
>>>>
>>>> And one more (snarky) comment. In my C++ setup, the "Run -> Compile 
>>>> file" selection is grayed out, so even if I wanted to, I can't work 
>>>> effectively.
>>>>
>>>> As to debug, well, since I have never gotten compiles and builds to 
>>>> work, I've never gotten as far as debugging. But if I had, there is 
>>>> no information as to what debugger is being used, this effects the 
>>>> compile phase, and I don't think that there is an option to allow 
>>>> specification of what debugger you want. There is also, no way to 
>>>> specify search paths, which in my case means that I have to change 
>>>> my Windows environment PATH to include cygwin paths.
>>>>
>>>> I've been asking for help for C/C++ setup for years, yep, years. I 
>>>> would be willing to take a try at developing documentation but I 
>>>> have never been able to get it to work so I can't write about 
>>>> anything but failures.
>>>>
>>>> If this all sounds like I'm frustrated, well, I am. And if it 
>>>> sounds, or looks, like I'm not accurate in what I say, it's because 
>>>> I don't know better. But, I truly do like NB, and I do think that 
>>>> the people who are movers and shakers have done a great job, and 
>>>> one which I would like to thank them for. But the developers 
>>>> attention have shifted from C/C++.
>>>>
>>>> art
>>>>
>>>> On 3/2/2025 6:07 PM, Ulf Zibis wrote:
>>>>> Hi Brad,
>>>>>
>>>>> it seems you have good luck with it.
>>>>>
>>>>> I have set up a small C project with NB 24 on Ubuntu to build a 
>>>>> library. Package ccls is installed. Must i be somehow registered 
>>>>> in NB?
>>>>> The build command is:
>>>>> cc -s -ggdb -shared -fPIC media.c -o libmedia.so
>>>>>
>>>>> When I set a breakpoint at some line and run "Debug", the program 
>>>>> does not stop at that line, and I don't see any variables.
>>>>>
>>>>> How does that work?
>>>>>
>>>>> Can someone tell me where the projects properties are saved?
>>>>> I don't see a folder like .nbproject in my projects folder.
>>>>>
>>>>> Regards,
>>>>> Ulf
>>>>>
>>>>> Am 24.11.24 um 18:50 schrieb Bradley Willcott:
>>>>>> There is a plug-in: CPPLite Kit.
>>>>>> I am using NB23.
>>>>>> This kit needs either: ccls, or clangd.
>>>>>>
>>>>>> I'm running on Linux and using ccls.
>>>>>> Regards,
>>>>>> Brad.
>>>>>>
>>>>>> On 23/11/24 23:58, Ron Patton wrote:
>>>>>>> Have you received an answer? I'm still on version 12 due to this
>>>>>>> issue.  I tried moving on from version 12 and the upgrade failed
>>>>>>> miserably.  The C/C++ issue was one of the impediments.
>>>>>>>
>>>>>>> 73,
>>>>>>> Ron / W4MMP
>>>>>>>
>>>>>>> On 11/8/2024 11:41, slipbits wrote:
>>>>>>>> Is C/C++ still supported? I've been trying to use Netbeans as 
>>>>>>>> my C/C++
>>>>>>>> IDE and have so far been unsuccessful. I have used it for Java 
>>>>>>>> with no
>>>>>>>> issues, but I can't seem to get it going for C/C++. Is there any
>>>>>>>> documentation or FAQ that can be used as a guideline for setup?
>>>>>>>>
>>>>>>>> thanks
>>>>>>>>
>>>>>>>>
>>>>>>>> --------------------------------------------------------------------- 
>>>>>>>>
>>>>>>>> To unsubscribe, e-mail: [email protected]
>>>>>>>> For additional commands, e-mail: [email protected]
>>>>>>>>
>>>>>>>> For further information about the NetBeans mailing lists, visit:
>>>>>>>> https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
>>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>> --------------------------------------------------------------------- 
>>>>>>
>>>>>> To unsubscribe, e-mail: [email protected]
>>>>>> For additional commands, e-mail: [email protected]
>>>>>>
>>>>>> For further information about the NetBeans mailing lists, visit:
>>>>>> https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
>>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: [email protected]
>>>>> For additional commands, e-mail: [email protected]
>>>>>
>>>>> For further information about the NetBeans mailing lists, visit:
>>>>> https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
>>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: [email protected]
>>>> For additional commands, e-mail: [email protected]
>>>>
>>>> For further information about the NetBeans mailing lists, visit:
>>>> https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [email protected]
>>> For additional commands, e-mail: [email protected]
>>>
>>> For further information about the NetBeans mailing lists, visit:
>>> https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>>
>> For further information about the NetBeans mailing lists, visit:
>> https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
> For further information about the NetBeans mailing lists, visit:
> https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.