Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

C++ managed includes native c-library - NCrunch can not build
mariusmeier
#1 Posted : Thursday, October 2, 2014 10:30:53 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 10/2/2014(UTC)
Posts: 4

Thanks: 1 times
Hello NCrunch team

First at all i am trying your trial version on my big project. It works quite well. I have one c++ managed project which includes
an native C-Project. This C-Project is not build by NCrunch because it can't find the additional header files (pthread.h, zlib.h etc) which
are included in the project file.
What can I do that NCrunch is building this project properly?

I am really thinking about buying a license because I like your work.

Best regards
Marius Meier
Remco
#2 Posted : Friday, October 3, 2014 10:28:44 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 6,976

Thanks: 931 times
Was thanked: 1257 time(s) in 1170 post(s)
Hi Marius, thanks for posting!

C/C++ projects aren't officially supported by NCrunch, but sometimes it is possible to get them building with some extra configuration.

Where are these additional header files stored in relation to the project file? Does including them using the Additional files to include setting make any difference?


Cheers,

Remco
mariusmeier
#3 Posted : Monday, October 6, 2014 6:40:02 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 10/2/2014(UTC)
Posts: 4

Thanks: 1 times
Hello Remco

I did test your suggestions and it worked for the native c-library. But the managed c++ library is still not building. It can't find some token symbols. Are there any
other possibilities to attend?
What would be your suggestion for this scenario? Only include the build managed c++ dll and not the whole project ?

Greetings,
Marius
Remco
#4 Posted : Monday, October 6, 2014 10:42:51 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 6,976

Thanks: 931 times
Was thanked: 1257 time(s) in 1170 post(s)
Hi Marius,

Great to hear we're making progress. If the problem is files missing from the workspace, the solution to the C++ library is likely to be largely the same as for the other project. NCrunch needs to be aware of all the files that are to be copied to the workspace, otherwise it may miss files and the build can fail. A useful way to troubleshoot build problems is to browse to the workspace built by NCrunch and to inspect it to see how it aligns with the project it was copied from. You can find the workspace by right clicking on the failed build in the Tests Window, then going to Advanced->Browse to workspace. It's also possible to invoke MSBuild.exe against the generated .proj file inside the workspace - this can be useful as you can run the build yourself in a similar way to NCrunch.

It's also worth having a look at the build troubleshooting guide if you haven't already. I'm sorry that I can only be of very limited help when troubleshooting C++ build issues, as NCrunch was never designed to target C++ and many build issues in this platform can be quite obscure.
mariusmeier
#5 Posted : Monday, October 6, 2014 2:42:37 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 10/2/2014(UTC)
Posts: 4

Thanks: 1 times
Hi Remco,

I tried to add the needed files also with the "additional files to include" option. But without any luck. I also tried the "Implicit Project Dependencies" to declare that the manage c++ library relies on the native c/c++ project (HDF5lib). Also without luck.
I looked into the NCrunch workspace for my solution. From there I build the .vcxproj file manually with MSBuild. Now I get some more error messages. I have opened the .vcxproj file in my notepad++ and looked at the content. I have noticed
that there is missing my "ProjectReference" which includes the HDF5lib. When i extend the NCrunch-vcxproj file with that and build it manually it all works. How can I add this content permanently without loosing it on the next build?

Greetings,
Marius
Remco
#6 Posted : Monday, October 6, 2014 10:53:18 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 6,976

Thanks: 931 times
Was thanked: 1257 time(s) in 1170 post(s)
Hi Marius,

This makes sense ... the dependency from the C++ project to the C project can't be tracked by NCrunch, as NCrunch isn't able to traverse the build dependencies between C++ projects.

I think the only way you can make this work would be to pre-compile the unmanaged C library then include it as a static reference from the other projects. This will then require a manual rebuild step in the IDE whenever you want NCrunch to become aware of changes you make to the C library, but it should allow NCrunch to build the solution and run tests.
1 user thanked Remco for this useful post.
mariusmeier on 10/7/2014(UTC)
mariusmeier
#7 Posted : Tuesday, October 7, 2014 7:13:13 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 10/2/2014(UTC)
Posts: 4

Thanks: 1 times
Hi Remco,

Ok thank you for your support. I tried your suggestion with the static linking and it works.

What exactly is your roadmap with the NCrunch project ? Are you planning in the future support for C/C++ (managed/native)? I think this would be great because it is not unusual that somebody would require to join native code with the managed world. Especially if you are working in the electronic industrie where you've got lot of low libraries for hardware components.

Greetings,
Marius
Remco
#8 Posted : Tuesday, October 7, 2014 9:37:26 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 6,976

Thanks: 931 times
Was thanked: 1257 time(s) in 1170 post(s)
Hi Marius,

Great to hear that got it working for you :)

At the moment there aren't any plans to introduce support for C/C++ projects. Support for this area of development would require considerable investment, so I'd need to see some evidence for high demand before I can put any priority on it. Right now, based on user feedback, it seems that most people are demanding support for Javascript instead. There is a C/C++ support feature request that you're welcome to cast your votes for if you like.

Cheers,

Remco
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

YAF | YAF © 2003-2011, Yet Another Forum.NET
This page was generated in 0.051 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download