0

I have two projects in my Visual Studio Community 2013 solution.

I created a project for Arduino, and create another project for Test. When I run the project tests without adding the Arduino project reference, it run ok, but when I add the Arduino project reference I get it error:

LNK1561: entry point must be defined D:\VisualStudioArduino\PrinterProject\LINK PrinterProject

What is the entry point for Arduino project?

It does not generate any file like a dll or main file?

What can I do to solve this error?

UPDATE I

I also tried this configuration in the Arduino Project but I get the same error:

Properties -> Linker -> System -> SubSystem to "Windows (/SUBSYSTEM:WINDOWS)"

UPDATE II

I am using Visual Micro extension. But the problems is when I try to compile the Test project. Then I recreate this scenario with a C++ console application and create a simple class, and create a test project and added the console application reference to test project and it worked. Then my doubts is about to how do I configure a Test Project to test my Arduino project.

1
  • When you create a Test project you need to add the project reference do you want to test. When I compile the arduino project it compiles ok, the problem is with the tests project.
    – Robert
    Commented Jun 1, 2015 at 15:20

4 Answers 4

1

I use Visual Studio Community Edition 2013 along with the Visual Micro extensions, which I think is what you need as the "missing link" between VS and Arduino.

3
  • I am using VSC Edition 2013 with Visual Micro, then when I compile the arduino there is not problem, the error is when I compile the Test project.
    – Robert
    Commented Jun 1, 2015 at 15:21
  • Sorry, I don't understand what are yout trying to do. You seem to want to "configure a Test Project to test your Arduino project.". What do you exactly mean with "test your Arduino project"? can you provide details?. do you mean to upload the program to the Arduino?
    – Roberto
    Commented Jun 2, 2015 at 12:49
  • When I create a class I want to create a test for this class: an Unit Test. I am trying to do a TDD development approach. Some object and function need to be stub, fake and also mocking.
    – Robert
    Commented Jun 2, 2015 at 15:28
0

You are trying to build a Windows program. You need a main() function as an entry point. I suspect that when your code is built through the Arduino IDE it adds in a main function in. You can tell Visual Studio to build your files differently by defining some build rules, but it sounds like someone may have done this sort of thing by looking at the other answers. But the easiest short term solution would be copying and pasting into the Arduino IDE.

0

Visual Studio knows nothing about an Arduino project. Why would you be trying to reference it from the other project. Short answer is that you are not understanding how to use Visual Studio and / or Arduino. Are you using it with some plugin for visual studio? If you are more than likely it does not support being part of a multi solution (at least that has been my experience with them).

Long answer is give some more details about what you are trying to do, including code from both projects.

Update: Sorry but this is not an Arduino topic. You are fundamentally incorrect in your understanding of how compilers and linkers work and what they are for. As are the other answers. You can not reference a project compiled for an Arduino, from a project compiled for Windows, period. I ask you to explain what you were trying to do and I would give you some idea how to accomplish that, but you did not answer. Yes you can use Visual Studio to compile your Arduino project, I do it every day. But I do not 'reference' it from another project on Windows. Do you have any idea what a reference is?

update 2: You can not create a test suite for an Arduino project, at least not in the traditional way. You can not even debug an Arduino project in the traditional way. Arduino is for prototyping, and very basic beginner stuff, and nothing more. What you are asking about is more traditional development, and the Arduino is not for that (and does not do it very well).

Create 2 separate solutions. One with only your visual micro project for the arduino, and another separate solution with a regular C++ or C# project, not a test project or anything special, just a plain console, or winforms, or WPF project. The 2 pieces of code must be run at the same time (F5), and probably connect to each other via the serial port, but it depends on what you are doing.

This IS NOT testing in a traditional sense. This is test running a project. The traditional sense of testing is to test isolated portions of code, which is different, and again, can not be done with an Arduino and visual studio. Since the Arduino only remotely provides 2 wire debugging, and I have never heard anyone actually get it to work at all, you can NOT do any traditional debugging or testing with an Arduino. Instead you are limited to beginner hacks (serial.print).

4
  • how do you create a test project for Arduino? Did you try something like it?
    – Robert
    Commented Jun 1, 2015 at 15:33
  • What are you asking? I am not the one with the question. I run a huge Arduino project every day, edited and built (from but not ) by Visual Studio. I used to run Visual Micro but stopped, it got in the way more than it helped.
    – user6569
    Commented Jun 2, 2015 at 2:03
  • ok, I just asked, maybe someone had been tried to test with visual studio. I am trying to run or create a TestSuite with native c++ to test my arduino classes. If I am using Visual Micro I thought to create the tests with Visual Studio but I am wrong. Thank you for your answer. If you have any idea or reference about how can I do tests for arduino I will be happy?
    – Robert
    Commented Jun 2, 2015 at 2:59
  • I think you might be a lot happier with .Net Microframework stuff. It is centuries ahead of Arduino for things like this. You still can not reference code directly, but at least you are working in the same framework (.Net). Problem is it is kind of mid-flux at the moment (Windows 10 IoT).
    – user6569
    Commented Jun 2, 2015 at 16:55
0

The best place for answers is in the Visual Micro forum.

  1. Be sure about is that the main .ino source file of your Arduino project matches both the name of the Visual Studio project and the name of the folder they existing in. For example:

    • Folder = Sketch1
    • Master Source = Sketch1.ino
    • Visual Studio Project Name = Sketch1

This ensure Visual Micro will compile the project and also it will be compatible with the Arduino Ide.

  1. With two projects in a Visual Studio solution it is important to note which is the "Startup Project". You can control which is the startup by right clicking a project in the explorer and clicking "Set as Startup project". The project name will then appear in bold.

The startup project affects which project is uploaded/started/debugged when you click any of the "Start" commands.

  1. The menu item "Build>Configuration Manager" allows you to exclude your Arduino project from Visual Studio Win32 builds but changing this option should not normally be required.

  2. You can right click each project and click "Start>New instance" to override the current "Startup project" and specifically build and upload a project.

Summary

If the build/upload fails and you see the visual studio c++ compiler error that you have described above this means that Visual Micro is not handling the build process for the project.

Therefore, please confirm point 1 is correct by trying out build task described in point 4 above.

It would be useful to know which build command you are selecting when the problem happens.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.